[DEBUG] correct the help tag in cmdline

This commit is contained in:
Edouard DUPIN 2015-06-01 21:48:34 +02:00
parent 049a853387
commit 1b72284d26
10 changed files with 60 additions and 61 deletions

View File

@ -9,6 +9,7 @@
#include <unistd.h>
#include <etk/types.h>
#include <etk/etk.h>
#include <etk/tool.h>
#include <etk/os/FSNode.h>
@ -329,7 +330,14 @@ ewol::Context::Context(ewol::context::Application* _application, int32_t _argc,
m_displayFps=true;
} else if ( m_commandLine.get(iii) == "-h"
|| m_commandLine.get(iii) == "--help") {
// TODO ...
EWOL_PRINT("ewol - help : ");
EWOL_PRINT(" " << etk::getApplicationName() << " [options]");
EWOL_PRINT(" --ewol-fps: Display the current fps of the display");
EWOL_PRINT(" -h/--help: Display this help");
EWOL_PRINT(" example:");
EWOL_PRINT(" " << etk::getApplicationName() << " --ewol-fps");
// this is a global help system does not remove it
continue;
} else {
continue;
}

View File

@ -24,6 +24,7 @@ namespace MacOs {
void setKeyboard(ewol::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey);
void setKeyboardMove(ewol::key::Special& _keyboardMode, enum ewol::key::keyboard _move, bool _isDown, bool _isAReapeateKey);
void stopRequested();
void setRedrawCallback(const std::function<void()>& _func);
};
#endif

View File

@ -211,6 +211,13 @@ void MacOs::stopRequested() {
interface->MAC_Stop();
}
void MacOs::setRedrawCallback(const std::function<void()>& _func) {
if (interface == nullptr) {
return;
}
interface->getWidgetManager().setCallbackonRedrawNeeded(_func);
}
/**
* @brief Main of the program
* @param std IO

View File

@ -5,7 +5,7 @@
*
* @license APACHE v2.0 (see license file)
*/
#include "Context.h"
#import <Cocoa/Cocoa.h>
#include "ewol/context/MacOs/Interface.h"
@ -16,6 +16,11 @@
id window = nil;
void callbackSomeThingToDo() {
//EWOL_CRITICAL("ksdjlkqjsdlfkjsqdlkfjslqkdjflqksjdf");
[window UpdateScreenRequested];
}
int mm_main(int _argc, const char* _argv[]) {
[NSAutoreleasePool new];
@ -74,23 +79,16 @@ int mm_main(int _argc, const char* _argv[]) {
NSRect window_frame = [window frame];
OpenGLView* view=[[OpenGLView alloc]initWithFrame:window_frame]; //NSMakeRect(0, 0, 800, 600)];
NSTrackingArea *track = [[NSTrackingArea alloc] initWithRect:window_frame options: NSTrackingMouseMoved | NSTrackingActiveWhenFirstResponder | NSTrackingActiveInKeyWindow
NSTrackingArea *track = [[NSTrackingArea alloc] initWithRect:window_frame options: NSTrackingMouseMoved | NSTrackingActiveWhenFirstResponder | NSTrackingActiveInKeyWindow
owner:window userInfo:nil];
[view addTrackingArea:track];
[view addTrackingArea:track];
[window setContentView:view];
[view setAutoresizesSubviews:YES];
// Override point for customization after application launch.
//[window addSubview:view];
//[window addChildWindow:view];
//[window makeKeyAndVisible];
//[window setDelegate:view];
// return no error
return 0;
}
int mm_run(void) {
//MacOs::setRedrawCallback(std::bind(callbackSomeThingToDo));
[NSApp run];
EWOL_DEBUG("END of application");
// return no error

View File

@ -13,7 +13,9 @@
@interface OpenGLView : NSOpenGLView<NSWindowDelegate> {
NSTimer* _refreshTimer;
bool _redraw;
}
- (void)prepareOpenGL;
- (void)drawRect:(NSRect) bounds;
- (void)UpdateScreenRequested;
@end

View File

@ -30,13 +30,17 @@
ewol::Dimension::setPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width,
(float)displayPixelSize.height/(float)displayPhysicalSize.height),
ewol::Dimension::Millimeter);
//_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
_redraw = true;
}
- (void)UpdateScreenRequested {
_redraw = true;
}
-(void) drawRect: (NSRect) bounds {
if ( ! _refreshTimer ) {
//_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
EWOL_WARNING("create timer ... ");
}
MacOs::draw(false);
@ -46,8 +50,11 @@
* Service the animation timer.
*/
- (void) animationTimerFired: (NSTimer *) timer {
[self setNeedsDisplay:YES];
EWOL_WARNING("view refresh ..." );
if (_redraw == true) {
//_redraw = false;
[self setNeedsDisplay:YES];
//EWOL_WARNING("view refresh ..." );
}
}
-(void)reshape {

View File

@ -7,9 +7,10 @@
*/
#import <Cocoa/Cocoa.h>
#import <ewol/context/MacOs/OpenglView.h>
@interface EwolMainWindows : NSWindow {
OpenGLView* _view;
}
+ (id)alloc;
- (id)init;
@ -32,6 +33,7 @@
- (void)keyDown:(NSEvent *)theEvent;
- (void)flagsChanged:(NSEvent *)theEvent;
- (void)closeRequestEwol;
- (void)UpdateScreenRequested;
@end

View File

@ -8,7 +8,6 @@
#import <ewol/context/MacOs/Windows.h>
#import <ewol/context/MacOs/OpenglView.h>
#include <ewol/context/MacOS/Context.h>
#include <ewol/key/key.h>
@ -52,11 +51,11 @@
NSRect window_frame = [windowsID frame];
EWOL_DEBUG("ALLOCATE ...");
OpenGLView* view=[[OpenGLView alloc]initWithFrame:window_frame]; //NSMakeRect(0, 0, 800, 600)];
_view=[[OpenGLView alloc]initWithFrame:window_frame]; //NSMakeRect(0, 0, 800, 600)];
EWOL_DEBUG("ALLOCATE ...");
[windowsID setContentView:view];
[windowsID setContentView:_view];
EWOL_DEBUG("ALLOCATE ...");
[view setAutoresizesSubviews:YES];
[_view setAutoresizesSubviews:YES];
EWOL_DEBUG("ALLOCATE ...");
// Override point for customization after application launch.
@ -79,7 +78,6 @@
+ (void)performClose:(id)sender {
EWOL_ERROR("perform close ...");
}
static ewol::key::Special guiKeyBoardMode;
@ -436,6 +434,9 @@ static ewol::key::Special guiKeyBoardMode;
MacOs::stopRequested();
}
- (void)UpdateScreenRequested {
[_view UpdateScreenRequested];
}
@end

View File

@ -157,48 +157,18 @@ void ewol::widget::Manager::focusRemoveIfRemove(const std::shared_ptr<ewol::Widg
}
}
/*
void ewol::widget::Manager::periodicCall(int64_t _localTime) {
int64_t previousTime = m_lastPeriodicCallTime;
m_lastPeriodicCallTime = _localTime;
if (m_listOfPeriodicWidget.size() <= 0) {
return;
}
float deltaTime = (float)(_localTime - previousTime)/1000000.0;
ewol::event::Time myTime(_localTime, m_applWakeUpTime, deltaTime, deltaTime);
EWOL_VERBOSE("periodic : " << _localTime);
for (int32_t iii=m_listOfPeriodicWidget.size()-1; iii >= 0 ; iii--) {
auto tmpWidget = m_listOfPeriodicWidget[iii].lock();
if (nullptr != tmpWidget) {
int64_t deltaTimeCallUser = tmpWidget->systemGetCallDeltaTime();
if (deltaTimeCallUser <= 0) {
myTime.setDeltaCall(deltaTime);
EWOL_VERBOSE("[" << iii << "] periodic : " << myTime);
tmpWidget->systemSetLastCallTime(_localTime);
tmpWidget->periodicCall(myTime);
} else {
int64_t lastCallTime = tmpWidget->systemGetLastCallTime();
if (lastCallTime == 0) {
lastCallTime = _localTime;
}
float deltaLocalTime = (float)(_localTime-lastCallTime)/1000000.0;;
if (deltaLocalTime >= lastCallTime) {
myTime.setDeltaCall(deltaLocalTime);
EWOL_VERBOSE("[" << iii << "] periodic : " << myTime);
tmpWidget->systemSetLastCallTime(_localTime);
tmpWidget->periodicCall(myTime);
}
}
}
}
void ewol::widget::Manager::setCallbackonRedrawNeeded(const std::function<void()>& _func) {
m_funcRedrawNeeded = _func;
}
*/
void ewol::widget::Manager::markDrawingIsNeeded() {
if (m_haveRedraw == true) {
return;
}
m_haveRedraw = true;
if (m_funcRedrawNeeded != nullptr) {
m_funcRedrawNeeded();
}
}
bool ewol::widget::Manager::isDrawingNeeded() {

View File

@ -36,9 +36,12 @@ namespace ewol {
void focusRelease(); // release focus from the current widget to the default
std::shared_ptr<ewol::Widget> focusGet();
void focusRemoveIfRemove(const std::shared_ptr<ewol::Widget>& _newWidget);
private:
std::function<void()> m_funcRedrawNeeded;
public:
void markDrawingIsNeeded();
bool isDrawingNeeded();
void setCallbackonRedrawNeeded(const std::function<void()>& _func);
// element that generate the list of elements
void addWidgetCreator(const std::string& _name, creator_tf _pointer);