ENH: PropertyNameButton was removed. PropertyRow manages all the callbacks now
This commit is contained in:
parent
d21fca47a9
commit
8fe1e1fcc6
|
@ -4,10 +4,8 @@ CMakeSetupGUIImplementation.cxx
|
||||||
FLTKDialog.cxx
|
FLTKDialog.cxx
|
||||||
FLTKPropertyItemRow.cxx
|
FLTKPropertyItemRow.cxx
|
||||||
FLTKPropertyList.cxx
|
FLTKPropertyList.cxx
|
||||||
FLTKPropertyNameButtonWithHelp.cxx
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
LINK_LIBRARIES(${FLTK_LIBRARY})
|
LINK_LIBRARIES(${FLTK_LIBRARY})
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
IF(NOT UNIX)
|
IF(NOT UNIX)
|
||||||
|
|
|
@ -127,7 +127,7 @@ void CMakeSetupGUI::Show(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeSetupGUI::SetBinaryPath(const char *) {
|
bool CMakeSetupGUI::SetBinaryPath(const char *) {
|
||||||
return true;}
|
}
|
||||||
|
|
||||||
bool CMakeSetupGUI::SetSourcePath(const char *) {
|
bool CMakeSetupGUI::SetSourcePath(const char *) {
|
||||||
return true;}
|
}
|
||||||
|
|
|
@ -7,11 +7,11 @@ gridy 5
|
||||||
snap 3
|
snap 3
|
||||||
class CMakeSetupGUI {open
|
class CMakeSetupGUI {open
|
||||||
} {
|
} {
|
||||||
Function {CMakeSetupGUI()} {open
|
Function {CMakeSetupGUI()} {open selected
|
||||||
} {
|
} {
|
||||||
Fl_Window dialogWindow {
|
Fl_Window dialogWindow {
|
||||||
label CMakeSetupDialog open
|
label CMakeSetupDialog
|
||||||
xywh {401 125 563 363} resizable visible
|
xywh {190 106 563 363} resizable visible
|
||||||
} {
|
} {
|
||||||
Fl_Input sourcePathTextInput {
|
Fl_Input sourcePathTextInput {
|
||||||
label {Where is the source code: }
|
label {Where is the source code: }
|
||||||
|
@ -25,7 +25,7 @@ class CMakeSetupGUI {open
|
||||||
}
|
}
|
||||||
Fl_Input binaryPathTextInput {
|
Fl_Input binaryPathTextInput {
|
||||||
label {Where do you want to build the binaries: }
|
label {Where do you want to build the binaries: }
|
||||||
callback {SetBinaryPath( binaryPathTextInput->value() );} selected
|
callback {SetBinaryPath( binaryPathTextInput->value() );}
|
||||||
xywh {219 50 200 20} labelsize 11 when 8 textsize 11
|
xywh {219 50 200 20} labelsize 11 when 8 textsize 11
|
||||||
}
|
}
|
||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
class CMakeSetupGUI {
|
class CMakeSetupGUI {
|
||||||
public:
|
public:
|
||||||
CMakeSetupGUI();
|
CMakeSetupGUI();
|
||||||
virtual ~CMakeSetupGUI();
|
|
||||||
Fl_Window *dialogWindow;
|
Fl_Window *dialogWindow;
|
||||||
Fl_Input *sourcePathTextInput;
|
Fl_Input *sourcePathTextInput;
|
||||||
private:
|
private:
|
||||||
|
@ -36,6 +35,7 @@ private:
|
||||||
public:
|
public:
|
||||||
Fl_Scroll *cacheValuesScroll;
|
Fl_Scroll *cacheValuesScroll;
|
||||||
Fl_Pack *propertyListPack;
|
Fl_Pack *propertyListPack;
|
||||||
|
~CMakeSetupGUI();
|
||||||
virtual void Close(void);
|
virtual void Close(void);
|
||||||
virtual void BuildProjectFiles(void);
|
virtual void BuildProjectFiles(void);
|
||||||
virtual void BrowseForSourcePath(void);
|
virtual void BrowseForSourcePath(void);
|
||||||
|
|
|
@ -141,8 +141,6 @@ CMakeSetupGUIImplementation
|
||||||
}
|
}
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
std::cout << "absolutePath = " << absolutePath << std::endl;
|
|
||||||
|
|
||||||
m_PathToExecutable = absolutePath;
|
m_PathToExecutable = absolutePath;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@ -150,7 +148,7 @@ CMakeSetupGUIImplementation
|
||||||
#else
|
#else
|
||||||
m_PathToExecutable += "/cmake";
|
m_PathToExecutable += "/cmake";
|
||||||
#endif
|
#endif
|
||||||
std::cout << "Path to CMake executable = " << m_PathToExecutable << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -324,20 +322,15 @@ CMakeSetupGUIImplementation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SaveCacheFromGUI();
|
|
||||||
|
|
||||||
// set the wait cursor
|
// set the wait cursor
|
||||||
fl_cursor(FL_CURSOR_WAIT,FL_BLACK,FL_WHITE);
|
fl_cursor(FL_CURSOR_WAIT,FL_BLACK,FL_WHITE);
|
||||||
// get all the info from the dialog
|
|
||||||
// this->UpdateData();
|
// save the current GUI values to the cache
|
||||||
if(!m_BuildPathChanged)
|
|
||||||
{
|
|
||||||
// if the build path has not changed save the
|
|
||||||
// current GUI values to the cache
|
|
||||||
this->SaveCacheFromGUI();
|
this->SaveCacheFromGUI();
|
||||||
}
|
|
||||||
// Make sure we are working from the cache on disk
|
// Make sure we are working from the cache on disk
|
||||||
this->LoadCacheFromDiskToGUI();
|
this->LoadCacheFromDiskToGUI();
|
||||||
|
|
||||||
// create a cmake object
|
// create a cmake object
|
||||||
cmake make;
|
cmake make;
|
||||||
// create the arguments for the cmake object
|
// create the arguments for the cmake object
|
||||||
|
@ -394,12 +387,14 @@ void
|
||||||
CMakeSetupGUIImplementation
|
CMakeSetupGUIImplementation
|
||||||
::SaveCacheFromGUI( void )
|
::SaveCacheFromGUI( void )
|
||||||
{
|
{
|
||||||
|
std::cout << "Saving cache from GUI ...";
|
||||||
this->FillCacheManagerFromCacheGUI();
|
this->FillCacheManagerFromCacheGUI();
|
||||||
if( m_WhereBuild != "" )
|
if( m_WhereBuild != "" )
|
||||||
{
|
{
|
||||||
cmCacheManager::GetInstance()->SaveCache(
|
cmCacheManager::GetInstance()->SaveCache(
|
||||||
m_WhereBuild.c_str() );
|
m_WhereBuild.c_str() );
|
||||||
}
|
}
|
||||||
|
std::cout << " Done ! " << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <FL/fl_ask.H>
|
#include <FL/fl_ask.H>
|
||||||
#include <FL/fl_file_chooser.H>
|
#include <FL/fl_file_chooser.H>
|
||||||
#include <FL/Fl_Color_Chooser.H>
|
#include <FL/Fl_Color_Chooser.H>
|
||||||
|
#include <FL/Fl_Menu_Button.H>
|
||||||
|
#include "../cmCacheManager.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
namespace fltk {
|
namespace fltk {
|
||||||
|
@ -38,14 +40,14 @@ PropertyItemRow::PropertyItemRow( PropertyItem * pItem ):Fl_Tile(0,0,10,10,"")
|
||||||
parent()->size( nameWidth + textWidth , rowHeight );
|
parent()->size( nameWidth + textWidth , rowHeight );
|
||||||
|
|
||||||
m_NameButton = new
|
m_NameButton = new
|
||||||
PropertyNameButtonWithHelp( firstColumn, 0, nameWidth, rowHeight,
|
Fl_Button( firstColumn, 0, nameWidth, rowHeight,
|
||||||
m_PropertyItem->m_propName.c_str() );
|
m_PropertyItem->m_propName.c_str() );
|
||||||
|
|
||||||
m_NameButton->align( FL_ALIGN_CLIP | FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
|
m_NameButton->align( FL_ALIGN_CLIP | FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
|
||||||
m_NameButton->labelsize( fontsize );
|
m_NameButton->labelsize( fontsize );
|
||||||
m_NameButton->box( FL_DOWN_BOX );
|
m_NameButton->box( FL_DOWN_BOX );
|
||||||
m_NameButton->SetHelpText( m_PropertyItem->m_HelpString.c_str() );
|
|
||||||
m_NameButton->size( secondColumn, rowHeight );
|
m_NameButton->size( secondColumn, rowHeight );
|
||||||
|
m_NameButton->callback( NameButtonCallback, (void *)m_PropertyItem );
|
||||||
|
|
||||||
switch( m_PropertyItem->m_nItemType )
|
switch( m_PropertyItem->m_nItemType )
|
||||||
{
|
{
|
||||||
|
@ -162,6 +164,68 @@ PropertyItemRow::~PropertyItemRow( )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PropertyItemRow::
|
||||||
|
NameButtonCallback( Fl_Widget * widget, void * data)
|
||||||
|
{
|
||||||
|
Fl_Button * button = (Fl_Button *)widget;
|
||||||
|
PropertyItem * pItem = (PropertyItem *)data;
|
||||||
|
|
||||||
|
static Fl_Menu_Button * popupMenu = 0;
|
||||||
|
if( !popupMenu )
|
||||||
|
{
|
||||||
|
int lastMousePositionX = Fl::event_x_root();
|
||||||
|
int lastMousePositionY = Fl::event_y_root();
|
||||||
|
popupMenu = new Fl_Menu_Button(lastMousePositionX,
|
||||||
|
lastMousePositionY,100,200);
|
||||||
|
}
|
||||||
|
|
||||||
|
popupMenu->type( Fl_Menu_Button::POPUP3 );
|
||||||
|
popupMenu->add("Help|Remove|Properties...");
|
||||||
|
popupMenu->popup();
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
HELP=0,
|
||||||
|
REMOVE,
|
||||||
|
PROPERTIES
|
||||||
|
} MenuOptions;
|
||||||
|
|
||||||
|
|
||||||
|
switch( popupMenu->value() )
|
||||||
|
{
|
||||||
|
case HELP:
|
||||||
|
fl_message( pItem->m_HelpString.c_str() );
|
||||||
|
break;
|
||||||
|
case REMOVE: // Remove
|
||||||
|
{
|
||||||
|
const char * propertyName = pItem->m_propName.c_str();
|
||||||
|
int answer = fl_ask( "Do you want to remove property %s", propertyName );
|
||||||
|
if( answer == 1 )
|
||||||
|
{
|
||||||
|
// Remove the entry from the cache
|
||||||
|
cmCacheManager::GetInstance()->RemoveCacheEntry( propertyName );
|
||||||
|
// Get the parent: Fl_Tile that manages the whole row in the GUI
|
||||||
|
Fl_Group * parentGroup = (Fl_Group *) (button->parent());
|
||||||
|
// Get the grandParent: Fl_Pack with the property list
|
||||||
|
Fl_Group * grandParentGroup = (Fl_Group *) parentGroup->parent();
|
||||||
|
// Remove the row from the list
|
||||||
|
grandParentGroup->remove( *parentGroup );
|
||||||
|
// Destroy the row
|
||||||
|
delete parentGroup; // Patricide... ?
|
||||||
|
// Redraw the list
|
||||||
|
grandParentGroup->redraw();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PROPERTIES: // Properties
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PropertyItemRow::
|
PropertyItemRow::
|
||||||
CheckButtonCallback( Fl_Widget * widget, void * data)
|
CheckButtonCallback( Fl_Widget * widget, void * data)
|
||||||
|
@ -255,26 +319,4 @@ BrowsePathCallback( Fl_Widget * widget, void * data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
PropertyItemRow::
|
|
||||||
handle(int event)
|
|
||||||
{
|
|
||||||
|
|
||||||
int status = Fl_Tile::handle( event );
|
|
||||||
switch( event )
|
|
||||||
{
|
|
||||||
case FL_LEAVE:
|
|
||||||
m_NameButton->HideHelp();
|
|
||||||
status = 1;
|
|
||||||
break;
|
|
||||||
case FL_MOVE:
|
|
||||||
m_NameButton->HideHelp();
|
|
||||||
status = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // end namespace fltk
|
} // end namespace fltk
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
#define FLTKPropertyItemRow_h
|
#define FLTKPropertyItemRow_h
|
||||||
|
|
||||||
#include "FLTKPropertyList.h"
|
#include "FLTKPropertyList.h"
|
||||||
#include "FLTKPropertyNameButtonWithHelp.h"
|
|
||||||
|
|
||||||
#include <FL/Fl_Tile.H>
|
#include <FL/Fl_Tile.H>
|
||||||
#include <FL/Fl_Input.H>
|
#include <FL/Fl_Input.H>
|
||||||
|
#include <FL/Fl_Button.H>
|
||||||
|
|
||||||
|
|
||||||
namespace fltk {
|
namespace fltk {
|
||||||
|
@ -32,19 +32,16 @@ class PropertyItemRow : public Fl_Tile
|
||||||
|
|
||||||
PropertyItemRow( PropertyItem * );
|
PropertyItemRow( PropertyItem * );
|
||||||
~PropertyItemRow();
|
~PropertyItemRow();
|
||||||
int handle(int event);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
PropertyItem * m_PropertyItem;
|
PropertyItem * m_PropertyItem;
|
||||||
ItemValue * m_ItemValue;
|
ItemValue * m_ItemValue;
|
||||||
|
Fl_Button * m_NameButton;
|
||||||
// Button that displays the property name and
|
|
||||||
// manages the popup help blob
|
|
||||||
PropertyNameButtonWithHelp * m_NameButton;
|
|
||||||
|
|
||||||
|
|
||||||
static void CheckButtonCallback( Fl_Widget *, void *);
|
static void CheckButtonCallback( Fl_Widget *, void *);
|
||||||
|
static void NameButtonCallback( Fl_Widget *, void *);
|
||||||
static void InputTextCallback( Fl_Widget *, void *);
|
static void InputTextCallback( Fl_Widget *, void *);
|
||||||
static void BrowsePathCallback( Fl_Widget *, void *);
|
static void BrowsePathCallback( Fl_Widget *, void *);
|
||||||
static void ColorSelectionCallback( Fl_Widget * widget, void * data);
|
static void ColorSelectionCallback( Fl_Widget * widget, void * data);
|
||||||
|
|
Loading…
Reference in New Issue