diff --git a/LFSApplications/ChangeLog b/LFSApplications/ChangeLog index 363402d..16e5ae7 100644 --- a/LFSApplications/ChangeLog +++ b/LFSApplications/ChangeLog @@ -1,4 +1,7 @@ 0.2.0 +Updated prefs apps. +Updated lfscolourchooser to include alpha component. +Updated lfstkprefs. Fixed first run filedialog. Added extra options to lfspanelprefs. Removed unnecessary meunitem from dock stacking. diff --git a/LFSApplications/LFSApplications/app/Makefile.am b/LFSApplications/LFSApplications/app/Makefile.am index 70ee7cd..1e6d10d 100644 --- a/LFSApplications/LFSApplications/app/Makefile.am +++ b/LFSApplications/LFSApplications/app/Makefile.am @@ -2,30 +2,31 @@ AUTOMAKE_OPTIONS = subdir-objects include ../flagsandlibs -lfsappearance_SOURCES = ../src/lfsappearance.cpp - lfstkprefs_SOURCES = ../src/lfstkprefs.cpp +lfsappearance_SOURCES = ../src/lfsappearance.cpp +lfsbackdropprefs_SOURCES = ../src/lfsbackdropprefs.cpp +lfsdesktopprefs_SOURCES = ../src/lfsdesktopprefs.cpp +lfspanelprefs_SOURCES = ../src/lfspanelprefs.cpp +lfswm2prefs_SOURCES = ../src/lfswm2prefs.cpp + +lfscolourchooser_SOURCES = ../src/lfscolourchooser.cpp +lfsabout_SOURCES = ../src/lfsabout.cpp +lfsfontselect_SOURCES = ../src/lfsfontselect.cpp +lfsruncommand_SOURCES = ../src/lfsruncommand.cpp +lfsmimeeditor_SOURCES = ../src/lfsmimeeditor.cpp lfswmprefs_SOURCES = ../src/lfswmprefs.cpp -lfsdesktopprefs_SOURCES = ../src/lfsdesktopprefs.cpp -lfsbackdropprefs_SOURCES = ../src/lfsbackdropprefs.cpp -lfspanelprefs_SOURCES = ../src/lfspanelprefs.cpp -lfswm2prefs_SOURCES = ../src/lfswm2prefs.cpp -lfsabout_SOURCES = ../src/lfsabout.cpp -lfsruncommand_SOURCES = ../src/lfsruncommand.cpp -lfsmimeeditor_SOURCES = ../src/lfsmimeeditor.cpp -lfsfontselect_SOURCES = ../src/lfsfontselect.cpp -lfscolourchooser_SOURCES = ../src/lfscolourchooser.cpp man1_MANS = ../resources/man/lfsapplications.1 -bin_PROGRAMS = lfsappearance lfstkprefs lfswmprefs lfsdesktopprefs lfsbackdropprefs lfspanelprefs lfswm2prefs lfsabout lfsruncommand lfsmimeeditor lfsfontselect lfscolourchooser +#bin_PROGRAMS = lfswmprefs +bin_PROGRAMS = lfstkprefs lfsappearance lfsbackdropprefs lfsdesktopprefs lfspanelprefs lfswm2prefs lfscolourchooser lfsabout lfsfontselect lfsruncommand lfsmimeeditor lfswmprefs diff --git a/LFSApplications/LFSApplications/src/lfscolourchooser.cpp b/LFSApplications/LFSApplications/src/lfscolourchooser.cpp index 048cc12..a959293 100755 --- a/LFSApplications/LFSApplications/src/lfscolourchooser.cpp +++ b/LFSApplications/LFSApplications/src/lfscolourchooser.cpp @@ -20,30 +20,34 @@ #include "config.h" #include +#include +#include +#include #include #define BOXLABEL "Colour Chooser" -LFSTK_applicationClass *apc=NULL; -LFSTK_windowClass *wc=NULL; +LFSTK_applicationClass *apc=NULL; +LFSTK_windowClass *wc=NULL; LFSTK_labelClass *label=NULL; LFSTK_labelClass *personal=NULL; LFSTK_labelClass *copyrite=NULL; -LFSTK_buttonClass *seperator=NULL; -LFSTK_buttonClass *quit=NULL; +LFSTK_buttonClass *seperator=NULL; +LFSTK_buttonClass *quit=NULL; LFSTK_scrollBarClass *red=NULL; LFSTK_scrollBarClass *blue=NULL; LFSTK_scrollBarClass *green=NULL; -LFSTK_lineEditClass *box=NULL; -LFSTK_lineEditClass *colour=NULL; -LFSTK_toggleButtonClass *check=NULL; -char *colourname=NULL; +LFSTK_scrollBarClass *alpha=NULL; +LFSTK_lineEditClass *box=NULL; +LFSTK_lineEditClass *colour=NULL; +LFSTK_toggleButtonClass *check=NULL; bool lockStep=false; -int lastred=255; -int lastgreen=255; -int lastblue=255; -int parentWindow=-1; +int lastred=255; +int lastgreen=255; +int lastblue=255; +int parentWindow=-1; +std::stringstream colourname; bool doQuit(void *p,void* ud) { @@ -81,31 +85,42 @@ bool scrollCB(void *p,void* ud) red->LFSTK_setValue(red->LFSTK_getValue()+diff,true); green->LFSTK_setValue(green->LFSTK_getValue()+diff,true); break; + case 4: + break; } } - free(colourname); lastred=red->LFSTK_getValue(); lastgreen=green->LFSTK_getValue(); lastblue=blue->LFSTK_getValue(); - - asprintf(&colourname,"#%02X%02X%02X",red->LFSTK_getValue(),green->LFSTK_getValue(),blue->LFSTK_getValue()); - box->LFSTK_setColourName(NORMALCOLOUR,colourname); - box->LFSTK_setCursorColourName(colourname); + colourname.clear(); + colourname.str(std::string()); + colourname << "#"<LFSTK_getValue(); + colourname << std::hex << std::uppercase<LFSTK_getValue(); + colourname << std::hex << std::uppercase<LFSTK_getValue(); + colourname << std::hex << std::uppercase<LFSTK_getValue(); + box->LFSTK_setGadgetColourPair(NORMALCOLOUR,colourname.str(),"black"); + box->LFSTK_setCursorColourName(colourname.str().c_str()); box->LFSTK_clearWindow(); - colour->LFSTK_setBuffer(colourname); + colour->LFSTK_setBuffer(colourname.str().c_str()); return(true); } void setSliders(const char *colour) { - colourStruct colptr; - colptr.name=NULL; + colourStruct colptr; + colptr=box->LFSTK_setColour(std::string(colour)); - wc->globalLib->LFSTK_setColourFromName(apc->display,apc->cm,&colptr,colour); red->LFSTK_setValue(colptr.RGBAColour.r*256,true); green->LFSTK_setValue(colptr.RGBAColour.g*256,true); blue->LFSTK_setValue(colptr.RGBAColour.b*256,true); + alpha->LFSTK_setValue(colptr.RGBAColour.a*256,true); +} + +bool lineCB(void *p,void *ud) +{ + setSliders(colour->LFSTK_getCStr()); + return(true); } int main(int argc, char **argv) @@ -157,11 +172,12 @@ int main(int argc, char **argv) personal->LFSTK_setCairoFontDataParts("B"); sy+=YSPACING; - label=new LFSTK_labelClass(wc,"R G B",BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE,LEFT); + label=new LFSTK_labelClass(wc,"R G B A",BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE,LEFT); label->LFSTK_setCairoFontDataParts("sB",20); sy+=YSPACING; - asprintf(&colourname,"#ffff00"); + colourname<LFSTK_setIgnores(false,false); @@ -183,21 +199,29 @@ int main(int argc, char **argv) blue->reverse=true; blue->LFSTK_setValue(255); + alpha=new LFSTK_scrollBarClass(wc,true,4*BORDER+3*SCROLLBARWIDTH+14,sy,SCROLLBARWIDTH,200+GADGETHITE,BUTTONGRAV); + alpha->LFSTK_setScale(0,255); + alpha->LFSTK_setPageScroll(16); + alpha->reverse=true; + alpha->LFSTK_setValue(255); + red->LFSTK_setMouseCallBack(NULL,scrollCB,(void*)1); green->LFSTK_setMouseCallBack(NULL,scrollCB,(void*)2); blue->LFSTK_setMouseCallBack(NULL,scrollCB,(void*)3); + alpha->LFSTK_setMouseCallBack(NULL,scrollCB,(void*)4); - box->LFSTK_setColourName(NORMALCOLOUR,colourname); - box->LFSTK_setCursorColourName(colourname); + box->LFSTK_setGadgetColourPair(NORMALCOLOUR,colourname.str(),"black"); + box->LFSTK_setCursorColourName(colourname.str().c_str()); box->LFSTK_setActive(false);//TODO// sy+=YSPACING; check=new LFSTK_toggleButtonClass(wc,"Lock sliders",3*BORDER+2*SCROLLBARWIDTH+GADGETWIDTH,sy+GADGETHITE*6-CHECKBOXSIZE,GADGETWIDTH,CHECKBOXSIZE,NorthWestGravity); check->LFSTK_setValue(false); - colour=new LFSTK_lineEditClass(wc,"",3*BORDER+2*SCROLLBARWIDTH+GADGETWIDTH,sy+GADGETHITE*7,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); - + colour=new LFSTK_lineEditClass(wc,"FFFFFFFF",3*BORDER+2*SCROLLBARWIDTH+GADGETWIDTH,sy+GADGETHITE*7,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); + colour->LFSTK_setKeyCallBack(NULL,lineCB,NULL); sy+=200; + //line seperator=new LFSTK_buttonClass(wc,"--",0,sy,DIALOGWIDTH,GADGETHITE,BUTTONGRAV); seperator->LFSTK_setStyle(BEVELNONE); diff --git a/LFSApplications/LFSApplications/src/lfstkprefs.cpp b/LFSApplications/LFSApplications/src/lfstkprefs.cpp index f416040..1a5e9a5 100644 --- a/LFSApplications/LFSApplications/src/lfstkprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfstkprefs.cpp @@ -294,78 +294,181 @@ void setPreviewData(void) wc->LFSTK_setTile(NULL,0); wc->LFSTK_setWindowColourName(0,windowColourEdit->LFSTK_getCStr()); } +// +// for (std::map::iterator it=ml->begin();it!=ml->end();++it) +// { +// mappedListener *mls=it->second; +// if (mls!=NULL) +// { +// if(mls->gadget!=NULL) +// { +// if(mls->type!=LINEEDITGADGET) +// { +////button +// mls->gadget->LFSTK_setFontString(buttonFontEdit->LFSTK_getCStr(),true); +// mls->gadget-> LFSTK_setLabelAutoColour(autoColourCheck->LFSTK_getValue()); +//mls->gadget->LFSTK_setGadgetColours(GADGETBG, +// previeBackColourEdit[NORMALCOLOUR]->LFSTK_getBuffer(), +// previeBackColourEdit[PRELIGHTCOLOUR]->LFSTK_getBuffer(), +// previeBackColourEdit[ACTIVECOLOUR]->LFSTK_getBuffer(), +// previeBackColourEdit[INACTIVECOLOUR]->LFSTK_getBuffer() +// ); +// +// ////for(int j=0;j<4;j++) +// //mls->gadget->LFSTK_setColourName(j,previeBackColourEdit[j]->LFSTK_getCStr()); +// //// mls->gadget->newGadgetBGColours[j]=mls->gadget->LFSTK_setColour(previeBackColourEdit[j]->LFSTK_getBuffer()); +// if(useTheme->LFSTK_getValue()==true) +// { +// if(mls->type==MENUBUTTONGADGET) +// mls->gadget->LFSTK_setTile(menuTileEdit->LFSTK_getCStr(),-1); +// else +// mls->gadget->LFSTK_setTile(buttonTileEdit->LFSTK_getCStr(),-1); +// } +// else +// mls->gadget->LFSTK_setTile(NULL,0); +// if(mls->type==MENUBUTTONGADGET) +// mls->gadget->LFSTK_setFontString(menuFontEdit->LFSTK_getCStr(),true); +////font +////mls->gadget-> LFSTK_setLabelAutoColour(true); +//mls->gadget->LFSTK_setGadgetColours(GADGETBG, +// std::string("white"), +// std::string("green"), +// std::string("green"), +// std::string("green") +// //previeFontColourEdit[PRELIGHTCOLOUR]->LFSTK_getBuffer(), +// //previeFontColourEdit[ACTIVECOLOUR]->LFSTK_getBuffer(), +// //previeFontColourEdit[INACTIVECOLOUR]->LFSTK_getBuffer() +// ); +// //std::string normal,std::string prelight,std::string active,std::string inactive) +// //for(int j=0;j<4;j++) +// // mls->gadget->LFSTK_clearWindow(); +// //mls->gadget->LFSTK_setFontColourName(j,previeFontColourEdit[j]->LFSTK_getCStr(),false); +// //// mls->gadget->newGadgetFGColours[j]=mls->gadget->LFSTK_setColour(previeFontColourEdit[j]->LFSTK_getBuffer()); +// //mls->gadget->LFSTK_setFontColourName(j,previeFontColourEdit[j]->LFSTK_getCStr(),false); +// } +// else +// { +// mls->gadget->LFSTK_setFontString(monoFontEdit->LFSTK_getCStr(),true); +// static_cast(mls->gadget)->LFSTK_setCursorColourName(cursorColourEdit->LFSTK_getCStr()); +// } +// } +// } +// } +//set examples - for (std::map::iterator it=ml->begin();it!=ml->end();++it) + for (std::map::iterator it=ml->begin();it!=ml->end();++it) + { + mappedListener *mls=it->second; + if (mls!=NULL) { - mappedListener *mls=it->second; - if (mls!=NULL) + if(mls->gadget!=NULL) { - if(mls->gadget!=NULL) + if(mls->type!=LINEEDITGADGET) { - if(mls->type!=LINEEDITGADGET) - { -//button - mls->gadget->LFSTK_setFontString(buttonFontEdit->LFSTK_getCStr(),true); - mls->gadget-> LFSTK_setLabelAutoColour(autoColourCheck->LFSTK_getValue()); - for(int j=0;j<4;j++) - mls->gadget->LFSTK_setColourName(j,previeBackColourEdit[j]->LFSTK_getCStr()); - - if(useTheme->LFSTK_getValue()==true) - { - if(mls->type==MENUBUTTONGADGET) - mls->gadget->LFSTK_setTile(menuTileEdit->LFSTK_getCStr(),-1); - else - mls->gadget->LFSTK_setTile(buttonTileEdit->LFSTK_getCStr(),-1); - } - else - mls->gadget->LFSTK_setTile(NULL,0); - if(mls->type==MENUBUTTONGADGET) - mls->gadget->LFSTK_setFontString(menuFontEdit->LFSTK_getCStr(),true); -//font - for(int j=0;j<4;j++) - mls->gadget->LFSTK_setFontColourName(j,previeFontColourEdit[j]->LFSTK_getCStr(),false); - } + if(useTheme->LFSTK_getValue()==true) + mls->gadget->LFSTK_setTile(buttonTileEdit->LFSTK_getCStr(),-1); else - { - mls->gadget->LFSTK_setFontString(monoFontEdit->LFSTK_getCStr(),true); - static_cast(mls->gadget)->LFSTK_setCursorColourName(cursorColourEdit->LFSTK_getCStr()); - } + mls->gadget->LFSTK_setTile(NULL,-1); } } } -//set examples -//buttons - for(int j=0;j<4;j++) - previewButtons[j]->LFSTK_setColourName(NORMALCOLOUR,previeBackColourEdit[j]->LFSTK_getCStr()); -//menuitems - for(int j=0;j<4;j++) - previewMenus[j]->LFSTK_setColourName(NORMALCOLOUR,previeMenuBackColourEdit[j]->LFSTK_getCStr()); - - for(int j=0;j<4;j++) - previewMenus[j]->LFSTK_setFontString(menuFontEdit->LFSTK_getCStr(),true); - if(useTheme->LFSTK_getValue()==true) - { - for(int j=0;j<4;j++) - previewMenus[j]->LFSTK_setTile(menuTileEdit->LFSTK_getCStr(),-1); - } - -//buttons font - for(int j=0;j<4;j++) - previewButtons[j]->LFSTK_setFontColourName(NORMALCOLOUR,previeFontColourEdit[j]->LFSTK_getCStr(),false); - -//menuitems font - for(int j=0;j<4;j++) - previewMenus[j]->LFSTK_setFontColourName(NORMALCOLOUR,previeMenuFontColourEdit[j]->LFSTK_getCStr(),false); } - cursorColourEdit->LFSTK_setColourName(NORMALCOLOUR,cursorColourEdit->LFSTK_getCStr()); + + +//set use theme + if(useTheme->LFSTK_getValue()==true) + { + for(int j=0;j<4;j++) + { + previewButtons[j]->LFSTK_setTile(buttonTileEdit->LFSTK_getCStr(),-1); + previewMenus[j]->LFSTK_setTile(menuTileEdit->LFSTK_getCStr(),-1); + } + } + else + { + for(int j=0;j<4;j++) + { + previewButtons[j]->LFSTK_setTile(NULL,-1); + previewMenus[j]->LFSTK_setTile(NULL,-1); + } + } + +//buttons + for(int j=0;j<4;j++) + { + previewButtons[j]->LFSTK_setLabelAutoColour(autoColourCheck->LFSTK_getValue()); + previewButtons[j]->LFSTK_setGadgetColourPair(NORMALCOLOUR,previeBackColourEdit[j]->LFSTK_getBuffer(),previeFontColourEdit[j]->LFSTK_getBuffer()); + } +//menus + for(int j=0;j<4;j++) + { + previewMenus[j]->LFSTK_setLabelAutoColour(autoColourCheck->LFSTK_getValue()); + previewMenus[j]->LFSTK_setGadgetColourPair(NORMALCOLOUR,previeMenuBackColourEdit[j]->LFSTK_getBuffer(),previeMenuFontColourEdit[j]->LFSTK_getBuffer()); + } +//buttons font + for(int j=0;j<4;j++) + previewButtons[j]->LFSTK_setFontString(buttonFontEdit->LFSTK_getCStr(),true); + +//menu font + for(int j=0;j<4;j++) + previewMenus[j]->LFSTK_setFontString(menuFontEdit->LFSTK_getCStr(),true); + +//mono font + monoFontDialogButton->LFSTK_setFontString(monoFontEdit->LFSTK_getCStr(),true); + +//others +// +////menuitems +// for(int j=0;j<4;j++) +// //previewMenus[j]->LFSTK_setColourName(NORMALCOLOUR,previeMenuBackColourEdit[j]->LFSTK_getCStr()); +// previewMenus[j]->newGadgetBGColours[NORMALCOLOUR]=previewMenus[j]->LFSTK_setColour(previeMenuBackColourEdit[j]->LFSTK_getBuffer()); +// +// for(int j=0;j<4;j++) +// previewMenus[j]->LFSTK_setFontString(menuFontEdit->LFSTK_getCStr(),true); +// if(useTheme->LFSTK_getValue()==true) +// { +// for(int j=0;j<4;j++) +// previewMenus[j]->LFSTK_setTile(menuTileEdit->LFSTK_getCStr(),-1); +// } +// +////buttons font +// for(int j=0;j<4;j++) +// //previewButtons[j]->LFSTK_setFontColourName(NORMALCOLOUR,previeFontColourEdit[j]->LFSTK_getCStr(),false); +// previewButtons[j]->newGadgetFGColours[NORMALCOLOUR]=previewButtons[j]->LFSTK_setColour(previeFontColourEdit[j]->LFSTK_getBuffer()); +// +////menuitems font +// for(int j=0;j<4;j++) +// previewMenus[j]->newGadgetFGColours[NORMALCOLOUR]=previewMenus[j]->LFSTK_setColour(previeMenuFontColourEdit[j]->LFSTK_getBuffer()); +// //previewMenus[j]->LFSTK_setFontColourName(NORMALCOLOUR,previeMenuFontColourEdit[j]->LFSTK_getCStr(),false); + } +// +// //cursorColourEdit->LFSTK_setColourName(NORMALCOLOUR,cursorColourEdit->LFSTK_getCStr()); + + + cursorColourEdit->LFSTK_setLabelAutoColour(true); + cursorColourEdit->LFSTK_setGadgetColourPair(NORMALCOLOUR,cursorColourEdit->LFSTK_getBuffer(),"#808080"); cursorColourEdit->LFSTK_setCursorColourName("#808080"); - scrollTroughColourEdit->LFSTK_setColourName(NORMALCOLOUR,scrollTroughColourEdit->LFSTK_getCStr()); + //cursorColourEdit->LFSTK_setCursorColourName(cursorColourEdit->newGadgetFGColours.at(NORMALCOLOUR).name.c_str()); + + scrollTroughColourEdit->LFSTK_setLabelAutoColour(true); + scrollTroughColourEdit->LFSTK_setGadgetColourPair(NORMALCOLOUR,scrollTroughColourEdit->LFSTK_getBuffer(),"#808080"); scrollTroughColourEdit->LFSTK_setCursorColourName("#808080"); - listTroughColourEdit->LFSTK_setColourName(NORMALCOLOUR,listTroughColourEdit->LFSTK_getCStr()); + + listTroughColourEdit->LFSTK_setLabelAutoColour(true); + listTroughColourEdit->LFSTK_setGadgetColourPair(NORMALCOLOUR,listTroughColourEdit->LFSTK_getBuffer(),"#808080"); listTroughColourEdit->LFSTK_setCursorColourName("#808080"); - windowColourEdit->LFSTK_setColourName(NORMALCOLOUR,windowColourEdit->LFSTK_getCStr()); - windowColourEdit->LFSTK_setCursorColourName("#808080"); + + //cursorColourEdit->newGadgetBGColours[NORMALCOLOUR]=cursorColourEdit->LFSTK_setColour(cursorColourEdit->LFSTK_getBuffer()); +// //scrollTroughColourEdit->LFSTK_setColourName(NORMALCOLOUR,scrollTroughColourEdit->LFSTK_getCStr()); +// scrollTroughColourEdit->newGadgetBGColours[NORMALCOLOUR]=scrollTroughColourEdit->LFSTK_setColour(scrollTroughColourEdit->LFSTK_getBuffer()); +// scrollTroughColourEdit->LFSTK_setCursorColourName("#808080"); +// //listTroughColourEdit->LFSTK_setColourName(NORMALCOLOUR,listTroughColourEdit->LFSTK_getCStr()); +// listTroughColourEdit->newGadgetBGColours[NORMALCOLOUR]=listTroughColourEdit->LFSTK_setColour(listTroughColourEdit->LFSTK_getBuffer()); +// listTroughColourEdit->LFSTK_setCursorColourName("#808080"); +// //windowColourEdit->LFSTK_setColourName(NORMALCOLOUR,windowColourEdit->LFSTK_getCStr()); +// windowColourEdit->newGadgetBGColours[NORMALCOLOUR]=windowColourEdit->LFSTK_setColour(windowColourEdit->LFSTK_getBuffer()); +// windowColourEdit->LFSTK_setCursorColourName("#808080"); wc->LFSTK_clearWindow(true); } diff --git a/LFSApplications/LFSApplications/src/lfswm2prefs.cpp b/LFSApplications/LFSApplications/src/lfswm2prefs.cpp index 216a2a6..17c57e5 100644 --- a/LFSApplications/LFSApplications/src/lfswm2prefs.cpp +++ b/LFSApplications/LFSApplications/src/lfswm2prefs.cpp @@ -72,7 +72,6 @@ LFSTK_menuClass *placeMenu=NULL; LFSTK_buttonClass *resizeWindowMenu=NULL; LFSTK_lineEditClass *resizeWindowEdit=NULL; menuStruct **resizeMenus; -//const char *resizeMenuNames[]={"Fast Resize","Live Resize","TBD","Scale Resize"}; const char *resizeMenuNames[]={"Fast Resize","Live Resize"}; LFSTK_menuClass *resizeMenu=NULL; @@ -87,7 +86,6 @@ LFSTK_menuClass *titlePosMenu=NULL; LFSTK_buttonClass *forceDockStackWindowMenu=NULL; LFSTK_lineEditClass *forceDockStackWindowEdit=NULL; menuStruct **forceDockStackMenus; -//const char *forceDockStackMenuNames[]={"Set By App","Force Above","Force Below"}; const char *forceDockStackMenuNames[]={"Force Above","Force Below"}; LFSTK_menuClass *forceDockStackMenu=NULL; @@ -96,7 +94,6 @@ LFSTK_buttonClass *modkeys1WindowMenu=NULL; LFSTK_lineEditClass *modkeys1WindowEdit=NULL; menuStruct **modkeys1Menus; const char *modkeys1MenuNames[]={"None","Shift","Caps Lock","Shift+Caps Lock","Control","Shift+Control","Caps Lock+Control","Shift+Caps Lock+Control"}; -//const char *modkeys1MenuNames[]={"None","Shift","Caps Lock","Control"}; LFSTK_menuClass *modkeys1Menu=NULL; //modkeys 2 @@ -149,7 +146,6 @@ bool buttonCB(void *p,void* ud) { const fontDataStruct *fd; msgBuffer mbuffer; - //reloadwm=false; if(ud!=NULL) { @@ -327,8 +323,7 @@ bool coleditCB(void *p,void* ud) free(col); for(int j=0;jLFSTK_setColourName(NORMALCOLOUR,previeColourEdit[j]->LFSTK_getCStr()); - previewButtons[j]->LFSTK_setFontColourName(NORMALCOLOUR,"black",false); + previewButtons[j]->LFSTK_setGadgetColourPair(NORMALCOLOUR,previeColourEdit[j]->LFSTK_getBuffer(),"black"); previewButtons[j]->LFSTK_clearWindow(); } } @@ -459,13 +454,7 @@ int main(int argc, char **argv) { modkeys1Menus[j]=new menuStruct; modkeys1Menus[j]->label=strdup(modkeys1MenuNames[j]); - //if(j==0) - modkeys1Menus[j]->userData=(void*)j; - // modkeys1Menus[j]->userData=0; - //else - //modkeys1Menus[j]->userData=(void*)(unsigned long)(1<<(j-1)); - - //fprintf(stderr,"menu ud=%x\n",modkeys1Menus[j]->userData); + modkeys1Menus[j]->userData=(void*)j; } modkeys2Menus=new menuStruct*[MODS2MENUSIZE]; for(long j=0;jlabel=strdup(modkeys2MenuNames[j]); modkeys2Menus[j]->userData=(void*)(unsigned long)(1<<(j+3)); - //modkeys2Menus[j]->userData=(void*)(unsigned long)(1<<(j)); } copyrite=new LFSTK_labelClass(wc,COPYRITE,BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE); @@ -488,8 +476,7 @@ int main(int argc, char **argv) previewButtons[j]=new LFSTK_buttonClass(wc,previewButtonLabels[j],sx,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); previewButtons[j]->LFSTK_setLabelAutoColour(true); previewButtons[j]->LFSTK_setTile(NULL,0); - previewButtons[j]->LFSTK_setColourName(NORMALCOLOUR,prefs.LFSTK_getCString(prefsnames[j])); - previewButtons[j]->LFSTK_setFontColourName(NORMALCOLOUR,"black",false); + previewButtons[j]->LFSTK_setGadgetColourPair(NORMALCOLOUR,prefs.LFSTK_getCString(prefsnames[j]),"black"); previewButtons[j]->LFSTK_setIgnores(false,true); sx+=GADGETWIDTH+BORDER; previeColourEdit[j]=new LFSTK_lineEditClass(wc,prefs.LFSTK_getCString(prefsnames[j]),sx,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); diff --git a/LFSApplications/LFSApplications/src/lfswmprefs.cpp b/LFSApplications/LFSApplications/src/lfswmprefs.cpp index b615dd5..fdb5359 100644 --- a/LFSApplications/LFSApplications/src/lfswmprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfswmprefs.cpp @@ -120,8 +120,7 @@ bool buttonCB(void *p,void* ud) { for(int j=0;j<5;j++) { - previewButtons[j]->LFSTK_setColourName(NORMALCOLOUR,previeColourEdit[j]->LFSTK_getCStr()); - previewButtons[j]->LFSTK_setFontColourName(NORMALCOLOUR,"black",false); + previewButtons[j]->LFSTK_setGadgetColourPair(NORMALCOLOUR,previeColourEdit[j]->LFSTK_getBuffer(),"black"); previewButtons[j]->LFSTK_clearWindow(); } return(true); @@ -187,8 +186,7 @@ bool coleditCB(void *p,void* ud) free(col); for(int j=0;j<5;j++) { - previewButtons[j]->LFSTK_setColourName(NORMALCOLOUR,previeColourEdit[j]->LFSTK_getCStr()); - previewButtons[j]->LFSTK_setFontColourName(NORMALCOLOUR,"black",false); + previewButtons[j]->LFSTK_setGadgetColourPair(NORMALCOLOUR,previeColourEdit[j]->LFSTK_getBuffer(),"black"); previewButtons[j]->LFSTK_clearWindow(); } } @@ -292,8 +290,7 @@ int main(int argc, char **argv) previewButtons[j]=new LFSTK_buttonClass(wc,previewButtonLabels[j],sx,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); previewButtons[j]->LFSTK_setLabelAutoColour(true); previewButtons[j]->LFSTK_setTile(NULL,0); - previewButtons[j]->LFSTK_setColourName(NORMALCOLOUR,prefs.LFSTK_getCString(prefsnames[j])); - previewButtons[j]->LFSTK_setFontColourName(NORMALCOLOUR,"black",false); + previewButtons[j]->LFSTK_setGadgetColourPair(NORMALCOLOUR,prefs.LFSTK_getCString(prefsnames[j]),"black"); previewButtons[j]->LFSTK_setIgnores(false,true); sx+=GADGETWIDTH+BORDER; previeColourEdit[j]=new LFSTK_lineEditClass(wc,prefs.LFSTK_getCString(prefsnames[j]),sx,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); diff --git a/LFSDesktop/LFSDesktop/src/globals.cpp b/LFSDesktop/LFSDesktop/src/globals.cpp index 45eff7e..045b732 100644 --- a/LFSDesktop/LFSDesktop/src/globals.cpp +++ b/LFSDesktop/LFSDesktop/src/globals.cpp @@ -78,7 +78,8 @@ void createDesktopGadget(LFSTK_windowClass *window) cf.item->LFSTK_setContextWindow(window); cf.item->LFSTK_setLabelAutoColour(false); - cf.item->LFSTK_setFontColourName(NORMALCOLOUR,foreCol,false); + //cf.item->LFSTK_setFontColourName(NORMALCOLOUR,foreCol,false); + cf.item->newGadgetFGColours[NORMALCOLOUR]=cf.item->LFSTK_setColour(foreCol); cf.item->LFSTK_setLabelBGColour(backCol,strtod(backAlpha,NULL)); cf.item->LFSTK_setFontString(fontFace,true); cf.item->drawLabelBG=true; diff --git a/LFSDesktop/LFSDesktop/src/prefs.cpp b/LFSDesktop/LFSDesktop/src/prefs.cpp index 2f46679..c733904 100644 --- a/LFSDesktop/LFSDesktop/src/prefs.cpp +++ b/LFSDesktop/LFSDesktop/src/prefs.cpp @@ -140,7 +140,9 @@ void reloadPrefs(void) setIconImage(&desktopItems.at(j)); desktopItems.at(j).item->LFSTK_setImageFromPath(desktopItems.at(j).iconPath,TOOLBAR,true); desktopItems.at(j).item->LFSTK_setLabelBGColour(backCol,strtod(backAlpha,NULL)); - desktopItems.at(j).item->LFSTK_setFontColourName(NORMALCOLOUR,foreCol,false) ; + //desktopItems.at(j).item->LFSTK_setFontColourName(NORMALCOLOUR,foreCol,false) ; + desktopItems.at(j).item->newGadgetFGColours[NORMALCOLOUR]=desktopItems.at(j).item->LFSTK_setColour(foreCol); + desktopItems.at(j).item->LFSTK_setFontString(fontFace,true); setItemSize(&desktopItems.at(j));//TODO// desktopItems.at(j).item->LFSTK_clearWindow(); diff --git a/LFSDock/ChangeLog b/LFSDock/ChangeLog index 9b17d0f..2edb5ca 100644 --- a/LFSDock/ChangeLog +++ b/LFSDock/ChangeLog @@ -1,4 +1,6 @@ 0.1.0 +Desktop switcher updates. +Pop up desktop list on rollover of swticher. Added workspace switcher. Removed legacy code. Code clean. diff --git a/LFSDock/LFSDock/src/clock.cpp b/LFSDock/LFSDock/src/clock.cpp index dd8b240..f5fc502 100644 --- a/LFSDock/LFSDock/src/clock.cpp +++ b/LFSDock/LFSDock/src/clock.cpp @@ -52,9 +52,7 @@ int addClock(int x,int y,int grav) clockButton->LFSTK_setIgnores(false,false); clockButton->LFSTK_setTile(NULL,0); - - clockButton->LFSTK_setColourName(NORMALCOLOUR,panelBGColour); - clockButton->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); + clockButton->LFSTK_setGadgetColourPair(NORMALCOLOUR,panelBGColour,panelTextColour); clockButton->LFSTK_setStyle(BEVELNONE); clockButton->drawLabelBG=true; diff --git a/LFSDock/LFSDock/src/desktopSwitcher.cpp b/LFSDock/LFSDock/src/desktopSwitcher.cpp index f83c65d..65ac7aa 100644 --- a/LFSDock/LFSDock/src/desktopSwitcher.cpp +++ b/LFSDock/LFSDock/src/desktopSwitcher.cpp @@ -38,6 +38,7 @@ bool deskSwitcherExitCB(LFSTK_gadgetClass*p,void* ud) switchIsUp=false; return(true); } +bool deskListCB(void* p,void* ud); bool deskSwitcherEnterCB(LFSTK_gadgetClass*p,void* ud) { @@ -51,6 +52,8 @@ bool deskSwitcherEnterCB(LFSTK_gadgetClass*p,void* ud) p->LFSTK_getGeom(&geom); p->LFSTK_moveGadget(geom.x,geom.y-adj); switchIsUp=true; + switchButton->LFSTK_setValue(true); + deskListCB( switchButton, ud); return(true); } @@ -63,7 +66,7 @@ bool deskListCB(void* p,void* ud) if(p!=NULL) { - if(bc->LFSTK_getValue()==1) + if(bc->LFSTK_getValue()==true) { bc->LFSTK_getGeomWindowRelative(&geom,apc->rootWindow); switch(panelGravity) @@ -88,7 +91,6 @@ bool deskListCB(void* p,void* ud) return(true); } - void sendPropNotifyMessage(Window win,Atom msg) { XEvent event; @@ -112,6 +114,9 @@ bool switchSelect(void *object,void* userdata) XChangeProperty(apc->display,apc->rootWindow,NET_CURRENT_DESKTOP,XA_CARDINAL,32,PropModeReplace,(const unsigned char*)&d,1); sendPropNotifyMessage(apc->rootWindow,NET_CURRENT_DESKTOP); + switchButton->LFSTK_setValue(false); + deskListCB(switchButton,NULL); + deskSwitcherExitCB(switchButton,NULL); return(true); } @@ -122,6 +127,7 @@ int addDesktopSwitcer(int x,int y,int grav) listLabelStruct ls; std::string label; propertyStruct props; + propReturn pr; if(switchButton!=NULL) { @@ -136,14 +142,8 @@ int addDesktopSwitcer(int x,int y,int grav) setGadgetDetails(switchButton); switchButton->LFSTK_setAlpha(1.0); switchButton->LFSTK_setStyle(BEVELNONE); - - switchButton->LFSTK_setColourName(NORMALCOLOUR,panelBGColour); - switchButton->LFSTK_setColourName(PRELIGHTCOLOUR,panelBGColour); - switchButton->LFSTK_setColourName(ACTIVECOLOUR,panelBGColour); - - switchButton->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); - switchButton->LFSTK_setFontColourName(PRELIGHTCOLOUR,panelTextColour,true); - switchButton->LFSTK_setFontColourName(ACTIVECOLOUR,panelTextColour,true); + switchButton->LFSTK_setGadgetColours(GADGETBG,panelBGColour,panelBGColour,panelBGColour,panelBGColour); + switchButton->LFSTK_setGadgetColours(GADGETFG,panelTextColour,panelTextColour,panelTextColour,panelTextColour); icon=mainwind->globalLib->LFSTK_findThemedIcon(desktopTheme,"remote-desktop",""); if(icon!=NULL) @@ -156,20 +156,22 @@ int addDesktopSwitcer(int x,int y,int grav) win->x=0; win->y=0; - win->w=100;//TODO// - win->h=GADGETHITE*6; + win->w=1;//TODO// + win->h=1;//GADGETHITE*6; apc->LFSTK_addToolWindow(win); switchWindow=apc->windows->back().window; - switchList=new LFSTK_listGadgetClass(switchWindow,"list",0,0,200,GADGETHITE*6);; - switchList->LFSTK_setMouseCallBack(NULL,switchSelect,NULL); + switchList=new LFSTK_listGadgetClass(switchWindow,"list",0,0,2000,2000);; + std::string lc="#60f0f0f0"; + std::string pc="#60a0a0a0"; + std::string ac="#60404040"; -// //switchWindow->LFSTK_setTile(NULL,0); -//// switchWindow->LFSTK_setWindowColourName(NORMALCOLOUR,"#00000000"); -//// switchList->LFSTK_setTile(NULL,0); -//// //switchList->LFSTK_setAlpha(128); -//// switchList->LFSTK_setColourName(NORMALCOLOUR,"#00000000"); -switchList->LFSTK_setStyle(BEVELNONE); - propReturn pr; + switchList->LFSTK_setStyle(BEVELNONE); + switchList->LFSTK_setLabelAutoColour(true); + switchList->LFSTK_setListItemsColours(GADGETBG,lc,pc,ac,lc); + switchList->LFSTK_setListItemsColours(GADGETFG,"red","red","red","red"); + switchList->LFSTK_setGadgetColourPair(NORMALCOLOUR,lc,"red"); + + switchList->LFSTK_setMouseCallBack(NULL,switchSelect,NULL); pr=apc->globalLib->LFSTK_getSingleProp(apc->display,apc->rootWindow,XInternAtom(apc->display,"_NET_DESKTOP_NAMES",false),XInternAtom(apc->display,"UTF8_STRING",false)); for(int j=0;jLFSTK_setStyle(BEVELNONE); ls.userData=USERDATA(j-1); switchList->LFSTK_appendToList(ls); } +/* +//TODO// +switchList->monoFontString=prefs.LFSTK_getCString(prefs.LFSTK_hashFromKey("font")); +switchList->LFSTK_resetListHeight(2000); +fprintf(stderr,"mfs=>>%s<<\n",switchList->monoFontString); +*/ + switchList->LFSTK_moveGadget(-1,-1); + switchWindow->LFSTK_resizeWindow(switchList->LFSTK_getListMaxWidth()-2,(GADGETHITE*pr.strlist.size())-4); + return(iconSize); } diff --git a/LFSDock/LFSDock/src/globals.cpp b/LFSDock/LFSDock/src/globals.cpp index 60998f3..780dc78 100644 --- a/LFSDock/LFSDock/src/globals.cpp +++ b/LFSDock/LFSDock/src/globals.cpp @@ -117,10 +117,7 @@ void setGadgetDetails(LFSTK_gadgetClass *gadget) { gadget->LFSTK_setAlpha(1.0); gadget->LFSTK_setTile(NULL,0); - gadget->LFSTK_setColourName(NORMALCOLOUR,"#00000000"); - gadget->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); gadget->gadgetDetails.bevel=BEVELNONE; - gadget->LFSTK_setColourName(PRELIGHTCOLOUR,"#00000000"); - gadget->LFSTK_setColourName(ACTIVECOLOUR,"#00000000"); - gadget->LFSTK_setColourName(INACTIVECOLOUR,"#00000000"); + gadget->LFSTK_setGadgetColours(GADGETBG,"#00000000","#00000000","#00000000","#00000000"); + gadget-> LFSTK_setGadgetColourPair(NORMALCOLOUR,"#00000000",panelTextColour); } diff --git a/LFSDock/LFSDock/src/slider.cpp b/LFSDock/LFSDock/src/slider.cpp index ab62df5..2d4d01b 100644 --- a/LFSDock/LFSDock/src/slider.cpp +++ b/LFSDock/LFSDock/src/slider.cpp @@ -206,13 +206,8 @@ int addSlider(int x,int y,int grav) volumeButton->LFSTK_setAlpha(1.0); volumeButton->LFSTK_setStyle(BEVELNONE); - volumeButton->LFSTK_setColourName(NORMALCOLOUR,panelBGColour); - volumeButton->LFSTK_setColourName(PRELIGHTCOLOUR,panelBGColour); - volumeButton->LFSTK_setColourName(ACTIVECOLOUR,panelBGColour); - - volumeButton->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); - volumeButton->LFSTK_setFontColourName(PRELIGHTCOLOUR,panelTextColour,true); - volumeButton->LFSTK_setFontColourName(ACTIVECOLOUR,panelTextColour,true); + volumeButton->LFSTK_setGadgetColours(GADGETBG,panelBGColour,panelBGColour,panelBGColour,panelBGColour); + volumeButton->LFSTK_setGadgetColours(GADGETBG,panelTextColour,panelTextColour,panelTextColour,panelTextColour); volumeButton->drawLabelBG=true; volumeButton->autoLabelBGColour=true; diff --git a/LFSPanel/LFSPanel/src/globals.cpp b/LFSPanel/LFSPanel/src/globals.cpp index e224b9e..d910a87 100644 --- a/LFSPanel/LFSPanel/src/globals.cpp +++ b/LFSPanel/LFSPanel/src/globals.cpp @@ -160,14 +160,17 @@ void setGadgetDetails(LFSTK_gadgetClass *gadget) { gadget->LFSTK_setAlpha(1.0); gadget->LFSTK_setTile(NULL,0); - gadget->LFSTK_setColourName(NORMALCOLOUR,panelColour); - gadget->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); + // gadget->LFSTK_setColourName(NORMALCOLOUR,panelColour); +//gadget->LFSTK_setFontColourName(NORMALCOLOUR,panelTextColour,true); + gadget->LFSTK_setGadgetColourPair(NORMALCOLOUR,panelColour,panelTextColour); + if(noButtons==true) { gadget->gadgetDetails.bevel=BEVELNONE; - gadget->LFSTK_setColourName(PRELIGHTCOLOUR,panelColour); - gadget->LFSTK_setColourName(ACTIVECOLOUR,panelColour); - gadget->LFSTK_setColourName(INACTIVECOLOUR,panelColour); + gadget->LFSTK_setGadgetColours(GADGETFG,panelColour,panelColour,panelColour,panelColour); +// gadget->LFSTK_setColourName(PRELIGHTCOLOUR,panelColour); +// gadget->LFSTK_setColourName(ACTIVECOLOUR,panelColour); +// gadget->LFSTK_setColourName(INACTIVECOLOUR,panelColour); } } } diff --git a/LFSToolKit/ChangeLog b/LFSToolKit/ChangeLog index 58a4b3e..2626549 100644 --- a/LFSToolKit/ChangeLog +++ b/LFSToolKit/ChangeLog @@ -1,4 +1,7 @@ 0.6.0 +Updates to list gadget class. +Redone colours. +Removed more legacy code. Added util function to lib lcass to get single cardinal/integer/string property for window. Fixed mouse enter/exit callbacks in toggle. Fixed segfault in image class. diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp index c1ded82..e41ae37 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKApplication.cpp @@ -30,9 +30,6 @@ LFSTK_applicationClass::~LFSTK_applicationClass() delete this->globalLib; delete this->windows; XCloseDisplay(this->display); - //free(this->configDir); - //if(this->iconThemeName!=NULL) - // free(this->iconThemeName); #ifdef _ENABLEDEBUG_ cairo_debug_reset_static_data(); #endif @@ -245,9 +242,6 @@ int LFSTK_applicationClass::LFSTK_runApp(void) this->useTimer=false; } } - - //-->>XFlush(this->display); - //-->>XSync(this->display,true); return(this->exitValue); } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp index 755ea0d..73ba1fe 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKButton.cpp @@ -49,18 +49,8 @@ LFSTK_buttonClass::LFSTK_buttonClass(LFSTK_windowClass* parentwc,const char* lab wa.win_gravity=gravity; wa.save_under=true; -// wa.border_pixel=0; -// wa.background_pixel=0; -// -// XVisualInfo vinfo; -// XMatchVisualInfo(this->wc->app->display,DefaultScreen(this->wc->app->display),32,TrueColor,&vinfo); -// -// this->visual=vinfo.visual; -// this->cmap=XCreateColormap(this->wc->app->display,DefaultRootWindow(this->wc->app->display),this->visual,AllocNone); -// wa.colormap=this->cmap; this->window=XCreateWindow(this->wc->app->display,this->parent,x,y,w,h,0,CopyFromParent,InputOutput,CopyFromParent,CWWinGravity|CWSaveUnder,&wa); - //this->window=XCreateWindow(this->wc->app->display,this->parent,x,y,w,h,0,32,InputOutput,CopyFromParent,(CWColormap | CWBorderPixel| CWBackPixel|CWWinGravity|CWSaveUnder),&wa); this->gc=XCreateGC(this->wc->app->display,this->window,0,NULL); this->wc->globalLib->LFSTK_setCairoSurface(this->wc->app->display,this->window,this->wc->app->visual,&this->sfc,&this->cr,w,h); @@ -79,9 +69,9 @@ LFSTK_buttonClass::LFSTK_buttonClass(LFSTK_windowClass* parentwc,const char* lab this->useTile=false; if(strcmp(this->label,"--")==0) - gadgetDetails={&this->colourNames[NORMALCOLOUR],BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,true}; + gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,true}; else - gadgetDetails={&this->colourNames[NORMALCOLOUR],BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; + gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; } /** diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKExpanderGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKExpanderGadget.cpp index b470214..311c1e6 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKExpanderGadget.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKExpanderGadget.cpp @@ -71,7 +71,7 @@ LFSTK_ExpanderGadgetClass::LFSTK_ExpanderGadgetClass(LFSTK_windowClass* parentwc else this->useTile=false; - gadgetDetails={&this->colourNames[PRELIGHTCOLOUR],BEVELNONE,NOINDICATOR,PRELIGHTCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,true}; + gadgetDetails={&this->newGadgetBGColours.at(PRELIGHTCOLOUR),BEVELNONE,NOINDICATOR,PRELIGHTCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,true}; this->hitRects.clear(); } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKFontDialog.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKFontDialog.cpp index 52fa164..ddd2f61 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKFontDialog.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKFontDialog.cpp @@ -401,5 +401,5 @@ LFSTK_fontDialogClass::LFSTK_fontDialogClass(LFSTK_windowClass* parentwc,const c fontData.isValid=false; this->buildDialog(); - gadgetDetails={&this->colourNames[NORMALCOLOUR],BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; + gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp index ad45855..f8643f5 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp @@ -35,29 +35,20 @@ LFSTK_gadgetClass::~LFSTK_gadgetClass() if(this->isMapped==true) this->LFSTK_reParentWindow(this->wc->window,0,0); +//TODO// for(int j=NORMALCOLOUR;jfontColourNames[j].name!=NULL) - { - free(this->fontColourNames[j].name); - XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->fontColourNames[j].pixel,1,0); - } - - if(this->colourNames[j].name!=NULL) - { - free(this->colourNames[j].name); - XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->colourNames[j].pixel,1,0); - } + if(this->newGadgetFGColours.at(j).isValid==true) + XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->newGadgetFGColours.at(j).pixel,1,0); + if(this->newGadgetBGColours.at(j).isValid==true) + XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->newGadgetBGColours.at(j).pixel,1,0); } if(this->fontString!=NULL) free(this->fontString); - if(this->labelBGColour.name!=NULL) - { - free(this->labelBGColour.name); - XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->labelBGColour.pixel,1,0); - } + if(this->labelBGColour.isValid==true) + XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->labelBGColour.pixel,1,0); cairo_destroy(this->cr); @@ -86,55 +77,6 @@ LFSTK_gadgetClass::LFSTK_gadgetClass() pad=2; } -/** -* Set the colour name for font. -* \param p Font state. -* \param colour Colour name. -* \param bool usewindow Use window colour. -* \note state is NORMALCOLOUR=0,PRELIGHTCOLOUR=1,ACTIVECOLOUR=2,INACTIVECOLOUR=3. -* \note font colour based on window or button back colour. -*/ -void LFSTK_gadgetClass::LFSTK_setFontColourName(int p,const char* colour,bool usewindow) -{ - XColor tc; - XColor sc; - colourStruct col=this->colourNames[p]; - - if(this->fontColourNames[p].name!=NULL) - free(this->fontColourNames[p].name); - this->fontColourNames[p].name=strdup(colour); - XAllocNamedColor(this->wc->app->display,this->wc->app->cm,colour,&sc,&tc); - this->fontColourNames[p].pixel=tc.pixel; - - if(usewindow==true) - col=this->wc->windowColourNames[0];//TODO// - - if((this->autoLabelColour==true) && (p!=INACTIVECOLOUR)) - { - if(strcmp(this->wc->globalLib->bestFontColour(col.pixel),"black")==0) - { - this->fontColourNames[p].RGBAColour.r=0.0; - this->fontColourNames[p].RGBAColour.g=0.0; - this->fontColourNames[p].RGBAColour.b=0.0; - this->fontColourNames[p].RGBAColour.a=1.0; - } - else - { - this->fontColourNames[p].RGBAColour.r=1.0; - this->fontColourNames[p].RGBAColour.g=1.0; - this->fontColourNames[p].RGBAColour.b=1.0; - this->fontColourNames[p].RGBAColour.a=1.0; - } - } - else - { - this->fontColourNames[p].RGBAColour.r=((this->fontColourNames[p].pixel>>16) & 0xff)/256.0; - this->fontColourNames[p].RGBAColour.g=((this->fontColourNames[p].pixel>>8) & 0xff)/256.0; - this->fontColourNames[p].RGBAColour.b=((this->fontColourNames[p].pixel>>0) & 0xff)/256.0; - this->fontColourNames[p].RGBAColour.a=1.0; - } -} - /** * Get the gadget's window ID. * \return Returns windows XID. @@ -179,55 +121,6 @@ void LFSTK_gadgetClass::LFSTK_setLabelBGColour(const char* colour,double alpha) this->labelBGColour.RGBAColour.a=alpha; } -/** -* Set the colour name for gadget. -* \param p Gadget state. -* \param colour Colour name. -* \note State is NORMALCOLOUR=0,PRELIGHTCOLOUR=1,ACTIVECOLOUR=2,INACTIVECOLOUR=3. -* \note Alpha of colour is set to alpha of window normal, unless specifically set. -*/ -void LFSTK_gadgetClass::LFSTK_setColourName(int p,const char* colour) -{ - XColor tc,sc; - std::string str=colour; - int alphaint=-1; - - if(this->colourNames[p].name!=NULL) - free(this->colourNames[p].name); - - this->colourNames[p].name=strdup(colour); - - if(str.at(0)=='#') - { - if(str.length()>7) - { - alphaint=std::stoi (str.substr(1,2),nullptr,16); - str.erase(str.begin()+1,str.begin()+3); - } - } - - XAllocNamedColor(this->wc->app->display,this->wc->app->cm,str.c_str(),&sc,&tc); - this->colourNames[p].pixel=sc.pixel; - - this->colourNames[p].RGBAColour.r=((this->colourNames[p].pixel>>16) & 0xff)/256.0; - this->colourNames[p].RGBAColour.g=((this->colourNames[p].pixel>>8) & 0xff)/256.0; - this->colourNames[p].RGBAColour.b=((this->colourNames[p].pixel>>0) & 0xff)/256.0; - - if(alphaint!=-1) - this->colourNames[p].RGBAColour.a=alphaint/256.0; - else - this->colourNames[p].RGBAColour.a=this->wc->windowColourNames[NORMALCOLOUR].RGBAColour.a; -// -// -//if(p==PRELIGHTCOLOUR) -//{ -//fprintf(stderr,"window alpha=%f\n",this->wc->windowColourNames[p].RGBAColour.a); -// fprintf(stderr,"r=%f g=%f b=%f a=%f\n",this->colourNames[p].RGBAColour.r,this->colourNames[p].RGBAColour.g,this->colourNames[p].RGBAColour.b,this->colourNames[p].RGBAColour.a); -// std::cout<<"str="<colourNames[p].name); + return(newGadgetBGColours.at(p).name.c_str()); } //needs re vamping void LFSTK_gadgetClass::initGadget(void) { - for(int j=0;jfontColourNames[j].name=NULL; - - for(int j=0;jcolourNames[j].name=NULL; - this->fontString=NULL; this->autoLabelColour=this->wc->autoLabelColour; - for(int j=0;jLFSTK_setColourName(j,this->wc->globalLib->LFSTK_getGlobalString(j,TYPEBUTTON)); + this->LFSTK_setGadgetColours(GADGETBG,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPEBUTTON), + this->wc->globalLib->LFSTK_getGlobalString(PRELIGHTCOLOUR,TYPEBUTTON), + this->wc->globalLib->LFSTK_getGlobalString(ACTIVECOLOUR,TYPEBUTTON), + this->wc->globalLib->LFSTK_getGlobalString(INACTIVECOLOUR,TYPEBUTTON)); + + this->LFSTK_setGadgetColours(GADGETFG,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPEFONTCOLOUR), + this->wc->globalLib->LFSTK_getGlobalString(PRELIGHTCOLOUR,TYPEFONTCOLOUR), + this->wc->globalLib->LFSTK_getGlobalString(ACTIVECOLOUR,TYPEFONTCOLOUR), + this->wc->globalLib->LFSTK_getGlobalString(INACTIVECOLOUR,TYPEFONTCOLOUR)); - for(int j=0;jLFSTK_setFontColourName(j,this->wc->globalLib->LFSTK_getGlobalString(j,TYPEFONTCOLOUR),false); this->LFSTK_setFontString(this->wc->globalLib->LFSTK_getGlobalString(-1,TYPEFONT)); this->monoFontString=this->wc->globalLib->LFSTK_getGlobalString(-1,TYPEMONOFONT); @@ -325,7 +217,6 @@ void LFSTK_gadgetClass::LFSTK_setKeyCallBack(bool (*downcb)(void *,void*),bool ( this->callBacks.keyReleaseCallback=releasecb; this->callBacks.keyUserData=ud; this->callBacks.runTheCallback=true; -// this->callBacks.ignoreOrphanModKeys=true; } /** @@ -367,7 +258,6 @@ void LFSTK_gadgetClass::LFSTK_setMouseMoveCallBack(bool (*entercb)(LFSTK_gadgetC this->callBacks.mouseExitCallback=exitcb; this->callBacks.mouseMoveUserData=ud; this->callBacks.runTheCallback=true; -// this->callBacks.ignoreOrphanModKeys=true; } /** @@ -459,7 +349,7 @@ void LFSTK_gadgetClass::clearBox(gadgetStruct* details) } if(this->isActive==false) - details->colour=&this->colourNames[INACTIVECOLOUR]; + details->colour=&newGadgetBGColours.at(INACTIVECOLOUR); if(this->isTransparent==true) details->colour=&this->wc->windowColourNames[NORMALCOLOUR]; @@ -614,7 +504,7 @@ void LFSTK_gadgetClass::drawLabel(gadgetStruct* details) { if(this->autoLabelBGColour==true) { - if(strcmp(this->wc->globalLib->bestFontColour(this->fontColourNames[details->state].pixel),"black")==0) + if(strcmp(this->wc->globalLib->bestFontColour(this->newGadgetFGColours.at(details->state).pixel),"black")==0) { lcol.r=0; lcol.g=0; @@ -638,7 +528,7 @@ void LFSTK_gadgetClass::drawLabel(gadgetStruct* details) } cairo_move_to(this->cr,labelx,labely); - cairo_set_source_rgba(this->cr,this->fontColourNames[details->state].RGBAColour.r,this->fontColourNames[details->state].RGBAColour.g,this->fontColourNames[details->state].RGBAColour.b,1.0); + cairo_set_source_rgba(this->cr,this->newGadgetFGColours.at(details->state).RGBAColour.r,this->newGadgetFGColours.at(details->state).RGBAColour.g,this->newGadgetFGColours.at(details->state).RGBAColour.b,1.0); cairo_show_text(this->cr,this->label); cairo_restore(this->cr); } @@ -743,7 +633,7 @@ bool LFSTK_gadgetClass::mouseUp(XButtonEvent *e) if(strcmp(this->label,"--")==0) return(true);; - this->gadgetDetails.colour=&this->colourNames[NORMALCOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(NORMALCOLOUR); this->gadgetDetails.state=NORMALCOLOUR; this->selectBevel(false); this->LFSTK_clearWindow(); @@ -782,7 +672,7 @@ bool LFSTK_gadgetClass::mouseDown(XButtonEvent *e) if(strcmp(this->label,"--")==0) return(true);; - this->gadgetDetails.colour=&this->colourNames[ACTIVECOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(ACTIVECOLOUR); this->gadgetDetails.state=ACTIVECOLOUR; this->selectBevel(true); this->LFSTK_clearWindow(); @@ -814,7 +704,7 @@ bool LFSTK_gadgetClass::mouseExit(XButtonEvent *e) if(strcmp(this->label,"--")==0) return(true);; - this->gadgetDetails.colour=&this->colourNames[NORMALCOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(NORMALCOLOUR); this->gadgetDetails.state=NORMALCOLOUR; this->LFSTK_clearWindow(); this->inWindow=false; @@ -846,7 +736,7 @@ bool LFSTK_gadgetClass::mouseEnter(XButtonEvent *e) if(strcmp(this->label,"--")==0) return(true); - this->gadgetDetails.colour=&this->colourNames[PRELIGHTCOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(PRELIGHTCOLOUR); this->gadgetDetails.state=PRELIGHTCOLOUR; this->LFSTK_clearWindow(); this->inWindow=true; @@ -1019,7 +909,6 @@ void LFSTK_gadgetClass::drawImage() cairo_save(this->cr); cairo_reset_clip (this->cr); cairo_translate(this->cr,xoffset,yoffset); -// cairo_scale(this->cr,this->imageXextraScale,this->imageYextraScale); cairo_set_source_surface(this->cr,this->cImage,0,0); cairo_set_operator(this->cr,CAIRO_OPERATOR_OVER); cairo_paint_with_alpha(this->cr,this->alpha); @@ -1141,7 +1030,6 @@ int LFSTK_gadgetClass::LFSTK_getTextWidth(const char* text) return((int)returnextents.x_advance); } - /** * Get height of text. * \returns text height @@ -1280,10 +1168,25 @@ void LFSTK_gadgetClass::LFSTK_getGeom(geometryStruct *geom) */ void LFSTK_gadgetClass::LFSTK_reloadColours(void) { - for(int j=0;jLFSTK_setFontColourName(j,this->wc->globalLib->LFSTK_getGlobalString(j,TYPEFONTCOLOUR),false); - for(int j=0;jLFSTK_setColourName(j,this->wc->globalLib->LFSTK_getGlobalString(j,TYPEBUTTON)); +//TODO// + for(int j=NORMALCOLOUR;jnewGadgetFGColours.at(j).isValid==true) + XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->newGadgetFGColours.at(j).pixel,1,0); + if(this->newGadgetBGColours.at(j).isValid==true) + XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->newGadgetBGColours.at(j).pixel,1,0); + } + + this->LFSTK_setGadgetColours(GADGETBG,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPEBUTTON), + this->wc->globalLib->LFSTK_getGlobalString(PRELIGHTCOLOUR,TYPEBUTTON), + this->wc->globalLib->LFSTK_getGlobalString(ACTIVECOLOUR,TYPEBUTTON), + this->wc->globalLib->LFSTK_getGlobalString(INACTIVECOLOUR,TYPEBUTTON)); + + this->LFSTK_setGadgetColours(GADGETFG,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPEFONTCOLOUR), + this->wc->globalLib->LFSTK_getGlobalString(PRELIGHTCOLOUR,TYPEFONTCOLOUR), + this->wc->globalLib->LFSTK_getGlobalString(ACTIVECOLOUR,TYPEFONTCOLOUR), + this->wc->globalLib->LFSTK_getGlobalString(INACTIVECOLOUR,TYPEFONTCOLOUR)); + this->LFSTK_setFontString(this->wc->globalLib->LFSTK_getGlobalString(-1,TYPEFONT)); this->autoLabelColour=this->wc->autoLabelColour; } @@ -1304,7 +1207,7 @@ void LFSTK_gadgetClass::drawIndicator(gadgetStruct* details) case CHECK: cairo_save(this->cr); cairo_reset_clip (this->cr); - cairo_set_source_rgba(this->cr,this->colourNames[details->state].RGBAColour.r,colourNames[details->state].RGBAColour.g,colourNames[details->state].RGBAColour.b,colourNames[details->state].RGBAColour.a); + cairo_set_source_rgba(this->cr,this->newGadgetBGColours.at(details->state).RGBAColour.r,this->newGadgetBGColours.at(details->state).RGBAColour.g,this->newGadgetBGColours.at(details->state).RGBAColour.b,this->newGadgetBGColours.at(details->state).RGBAColour.a); cairo_rectangle(this->cr,details->indicatorGeom.x,details->indicatorGeom.y,details->indicatorGeom.w,details->indicatorGeom.h); cairo_fill(this->cr); @@ -1335,8 +1238,7 @@ void LFSTK_gadgetClass::drawIndicator(gadgetStruct* details) cairo_reset_clip (this->cr); cairo_set_antialias (this->cr,CAIRO_ANTIALIAS_NONE); cairo_set_line_width(this->cr,1.0); - - cairo_set_source_rgba(this->cr,this->fontColourNames[details->state].RGBAColour.r,fontColourNames[details->state].RGBAColour.g,fontColourNames[details->state].RGBAColour.b,fontColourNames[details->state].RGBAColour.a); + cairo_set_source_rgba(this->cr,this->newGadgetFGColours.at(details->state).RGBAColour.r,this->newGadgetFGColours.at(details->state).RGBAColour.g,this->newGadgetFGColours.at(details->state).RGBAColour.b,this->newGadgetFGColours.at(details->state).RGBAColour.a); cairo_move_to(this->cr,details->indicatorGeom.x,(details->gadgetGeom.h/2)-(details->indicatorGeom.h/2)); cairo_line_to(this->cr,details->indicatorGeom.x+details->indicatorGeom.w,details->gadgetGeom.h/2); cairo_line_to(this->cr,details->indicatorGeom.x,details->indicatorGeom.y+details->indicatorGeom.h); @@ -1391,7 +1293,7 @@ void LFSTK_gadgetClass::drawBox(geometryStruct* g,gadgetState state,bevelType be } cairo_save(this->cr); cairo_reset_clip (this->cr); - cairo_set_source_rgba(this->cr,this->colourNames[state].RGBAColour.r,this->colourNames[state].RGBAColour.g,this->colourNames[state].RGBAColour.b,this->colourNames[state].RGBAColour.a); + cairo_set_source_rgba(this->cr,this->newGadgetBGColours.at(state).RGBAColour.r,this->newGadgetBGColours.at(state).RGBAColour.g,this->newGadgetBGColours.at(state).RGBAColour.b,this->newGadgetBGColours.at(state).RGBAColour.a); cairo_paint(this->cr); if(bevel!=BEVELNONE) @@ -1917,3 +1819,110 @@ void LFSTK_gadgetClass::LFSTK_setStyle(bevelType s) { this->style=s; } + +/** +* Set a colour name. +* \param colour Colour name. +* \note Alpha of colour is set to alpha of window normal, unless specifically set. +* \return A populated colourStruct. +*/ +colourStruct LFSTK_gadgetClass::LFSTK_setColour(std::string colour) +{ + XColor tc,sc; + std::string str=colour; + int alphaint=-1; + colourStruct cs; + + cs.name=colour; + + if(cs.name.at(0)=='#') + { + if(cs.name.length()>7) + { + alphaint=std::stoi (cs.name.substr(1,2),nullptr,16); + cs.name.erase(cs.name.begin()+1,cs.name.begin()+3); + } + } + + if(XAllocNamedColor(this->wc->app->display,this->wc->app->cm,cs.name.c_str(),&sc,&tc)!=0) + { + cs.pixel=sc.pixel; + cs.RGBAColour.r=((cs.pixel>>16) & 0xff)/256.0; + cs.RGBAColour.g=((cs.pixel>>8) & 0xff)/256.0; + cs.RGBAColour.b=((cs.pixel>>0) & 0xff)/256.0; + + if(alphaint!=-1) + cs.RGBAColour.a=alphaint/256.0; + else + cs.RGBAColour.a=this->wc->windowColourNames[NORMALCOLOUR].RGBAColour.a; + cs.isValid=true; + } + else + cs.isValid=false; + + return(cs); +} + +/** +* Set gadget colours. +* \param gadgetColourType Colour type GADGETBG GADGETFG. +* \param std::string normal Colour name (eg "grey", "#80ff00ff"). +* \param std::string prelight " +* \param std::string active " +* \param std::string inactive " +*/ +void LFSTK_gadgetClass::LFSTK_setGadgetColours(gadgetColourType type,std::string normal,std::string prelight,std::string active,std::string inactive) +{ + colourStruct cs; + + if(type==GADGETBG) + { + this->newGadgetBGColours[NORMALCOLOUR]=this->LFSTK_setColour(normal); + this->newGadgetBGColours[PRELIGHTCOLOUR]=this->LFSTK_setColour(prelight); + this->newGadgetBGColours[ACTIVECOLOUR]=this->LFSTK_setColour(active); + this->newGadgetBGColours[INACTIVECOLOUR]=this->LFSTK_setColour(inactive); + } + else + { + + this->newGadgetFGColours[INACTIVECOLOUR]=this->LFSTK_setColour(inactive); + + if(this->autoLabelColour==false) + { + this->newGadgetFGColours[NORMALCOLOUR]=this->LFSTK_setColour(normal); + this->newGadgetFGColours[PRELIGHTCOLOUR]=this->LFSTK_setColour(prelight); + this->newGadgetFGColours[ACTIVECOLOUR]=this->LFSTK_setColour(active); + } + else + { + for(int j=0;j<3;j++) + { + if(strcmp(this->wc->globalLib->bestFontColour(this->newGadgetBGColours.at(j).pixel),"black")==0) + this->newGadgetFGColours[j]=this->LFSTK_setColour("black"); + else + this->newGadgetFGColours[j]=this->LFSTK_setColour("white"); + } + } + } +} + +/** +* Set pair of gadget colours bg/fg. +* \param gadgetState state NORMALCOLOUR etc. +* \param std::string back Colour BG name (eg "grey", "#80ff00ff"). +* \param std::string fore Colour FG name (eg "grey", "#80ff00ff"). +* \note will set auto colour FG if set. +*/ +void LFSTK_gadgetClass::LFSTK_setGadgetColourPair(gadgetState state,std::string back,std::string fore) +{ + this->newGadgetBGColours[state]=this->LFSTK_setColour(back); + if(this->autoLabelColour==false) + this->newGadgetFGColours[state]=this->LFSTK_setColour(fore); + else + { + if(strcmp(this->wc->globalLib->bestFontColour(this->newGadgetBGColours.at(state).pixel),"black")==0) + this->newGadgetFGColours[state]=this->LFSTK_setColour("black"); + else + this->newGadgetFGColours[state]=this->LFSTK_setColour("white"); + } +} \ No newline at end of file diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h index a527ffb..c8c122b 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h @@ -101,14 +101,16 @@ class LFSTK_gadgetClass callbackStruct callBacks; -//colours - colourStruct fontColourNames[MAXCOLOURS]={NULL,}; - colourStruct colourNames[MAXCOLOURS]={NULL,}; +//new colours + std::vector newGadgetBGColours={{},{},{},{}}; + std::vector newGadgetFGColours={{},{},{},{}}; + colourStruct LFSTK_setColour(std::string colour); + void LFSTK_setGadgetColours(gadgetColourType type,std::string normal,std::string prelight,std::string active,std::string inactive); + void LFSTK_setGadgetColourPair(gadgetState state,std::string back,std::string fore); - void LFSTK_setColourName(int p,const char* colour); +//colours const char *LFSTK_getColourName(int p); void LFSTK_setFontString(const char *s,bool setfontdata=false); - void LFSTK_setFontColourName(int p,const char* colour,bool usewindow); void LFSTK_reloadColours(void); void LFSTK_setActive(bool active); @@ -132,8 +134,7 @@ class LFSTK_gadgetClass void LFSTK_setAlpha(double alph); void LFSTK_setStyle(bevelType s); -std::string imagePath; -bool noClear=false; +std::string imagePath;//????? //geometry void LFSTK_getGeom(geometryStruct *geom); void LFSTK_getGeomWindowRelative(geometryStruct *geom,Window win); @@ -155,7 +156,7 @@ bool noClear=false; bool drawLabelBG=false; bool autoLabelBGColour=false; - colourStruct labelBGColour={NULL,0,{1.0,1.0,1.0,1.0}}; + colourStruct labelBGColour={"",false,0,{1.0,1.0,1.0,1.0}}; void LFSTK_setLabelBGColour(double r,double g,double b,double a); void LFSTK_setLabelBGColour(const char* colour,double alpha); @@ -165,7 +166,7 @@ bool noClear=false; bool gadgetAcceptsDnD; bool isSubMenu; bool showIndicator; - gadgetStruct gadgetDetails={&this->colourNames[NORMALCOLOUR],BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,false,{0,0,0,0},{0,0,0,0},false,false,false,false,false}; + gadgetStruct gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELOUT,NOINDICATOR,NORMALCOLOUR,0,false,{0,0,0,0},{0,0,0,0},false,false,false,false,false}; const char *monoFontString=NULL; //user data @@ -177,8 +178,8 @@ bool noClear=false; //context contextPostition contextWindowPos=CONTEXTRIGHT; -//double imageXextraScale=1.0; -//double imageYextraScale=1.0; +bool inWindow;//TODO//MMMMmmmmmmm + private: void initGadget(void); void selectBevel(bool mousedown); @@ -206,7 +207,7 @@ bool noClear=false; char *fontName=NULL; double maxTextHeight; - bool inWindow; +// bool inWindow; bool isActive; bool autoLabelColour=false; int labelGravity; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h index f3dcc17..658df34 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h @@ -84,6 +84,8 @@ enum contextPostition {CONTEXTLEFT,CONTEXTRIGHT,CONTEXTATMOUSE}; //dropdata enum dropDataType {DROPINVALID=0,DROPTEXT,DROPURI}; +enum gadgetColourType {GADGETBG,GADGETFG}; + struct geometryStruct { int x,y; @@ -310,7 +312,8 @@ struct cairoColor struct colourStruct { - char *name; + std::string name; + bool isValid=false; long pixel; cairoColor RGBAColour; }; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLabel.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLabel.cpp index 59d705e..a68b04f 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLabel.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLabel.cpp @@ -74,7 +74,6 @@ LFSTK_labelClass::LFSTK_labelClass(LFSTK_windowClass* parentwc,const char* label else this->useTile=false; - this->LFSTK_setFontColourName(0,this->wc->globalLib->LFSTK_getGlobalString(0,TYPEFONTCOLOUR),true); gadgetDetails={&this->wc->windowColourNames[NORMALCOLOUR],BEVELNONE,NOINDICATOR,NORMALCOLOUR,0,false,{0,0,w,h},{0,0,0,0},false,false,true}; this->LFSTK_setLabelGravity(gravity); } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp index 65abb44..941e303 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp @@ -758,11 +758,9 @@ bool LFSTK_lib::LFSTK_pointInRect(pointStruct *point,geometryStruct *geom) void LFSTK_lib::LFSTK_setColourFromName(Display *display,Colormap cm,colourStruct *colptr,const char *name) { XColor tc,sc; - if(colptr->name!=NULL) + if(colptr->isValid==true) { - free(colptr->name); - colptr->name=strdup(name); - + colptr->name=name; XFreeColors(display,cm,(long unsigned int*)&colptr->pixel,1,0); } XAllocNamedColor(display,cm,name,&sc,&tc); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp index 990134d..22ba063 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.cpp @@ -25,11 +25,8 @@ LFSTK_lineEditClass::~LFSTK_lineEditClass() { - if(this->cursorColour.name!=NULL) - { - free(this->cursorColour.name); - XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->cursorColour.pixel,1,0); - } + if(this->cursorColour.isValid==true) + XFreeColors(this->wc->app->display,this->wc->app->cm,(long unsigned int*)&this->cursorColour.pixel,1,0); } LFSTK_lineEditClass::LFSTK_lineEditClass() @@ -112,11 +109,12 @@ LFSTK_lineEditClass::LFSTK_lineEditClass(LFSTK_windowClass* parentwc,const char* this->gadgetAcceptsDnD=true; this->labelGravity=LEFT; - LFSTK_setColourName(NORMALCOLOUR,"white"); - LFSTK_setFontColourName(NORMALCOLOUR,"black",false); - this->charWidth=LFSTK_getTextRealWidth("X"); + this->newGadgetBGColours[NORMALCOLOUR]=this->LFSTK_setColour("white"); + this->newGadgetFGColours[NORMALCOLOUR]=this->LFSTK_setColour("black"); this->LFSTK_setCursorColourName(this->wc->globalLib->LFSTK_getGlobalString(-1,TYPECURSORCOLOUR)); - gadgetDetails={&this->colourNames[NORMALCOLOUR],BEVELIN,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; + this->charWidth=LFSTK_getTextRealWidth("X"); + + gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELIN,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; this->isFocused=false; this->inWindow=false; @@ -276,9 +274,9 @@ void LFSTK_lineEditClass::LFSTK_setBuffer(const char *str) * \return Return's a std::string. * \note Don't free the returned string. */ -const std::string* LFSTK_lineEditClass::LFSTK_getBuffer(void) +std::string LFSTK_lineEditClass::LFSTK_getBuffer(void) { - return(const_cast(&(this->buffer))); + return(this->buffer); } /** @@ -304,7 +302,7 @@ void LFSTK_lineEditClass::drawLabel(void) cairo_save(this->cr); cairo_reset_clip(this->cr); - cairo_set_source_rgba(this->cr,this->colourNames[NORMALCOLOUR].RGBAColour.r,this->colourNames[NORMALCOLOUR].RGBAColour.g,this->colourNames[NORMALCOLOUR].RGBAColour.b,this->colourNames[NORMALCOLOUR].RGBAColour.a); + cairo_set_source_rgba(this->cr,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.a); cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); cairo_paint(this->cr); cairo_restore(this->cr); @@ -312,7 +310,7 @@ void LFSTK_lineEditClass::drawLabel(void) cairo_save(this->cr); cairo_select_font_face(this->cr,this->fontName,this->slant,this->weight); cairo_set_font_size(this->cr,fontSize); - cairo_set_source_rgba(this->cr,0.0,0,0,1.0); + cairo_set_source_rgba(this->cr,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.a); if(this->LFSTK_getTextWidth("X")<=0) maxchars=((this->gadgetGeom.w)/(int)((8))); @@ -351,13 +349,13 @@ void LFSTK_lineEditClass::drawLabel(void) cairo_set_source_rgba(this->cr,this->cursorColour.RGBAColour.r,this->cursorColour.RGBAColour.g,this->cursorColour.RGBAColour.b,this->cursorColour.RGBAColour.a); cairo_rectangle(this->cr,partextents.x_advance+this->pad,yoffset-this->fontExtents.ascent,charextents.x_advance-0.5,this->fontExtents.ascent+this->fontExtents.descent); cairo_fill(this->cr); - cairo_set_source_rgba(this->cr,1.0,1.0,1.0,1.0); + cairo_set_source_rgba(this->cr,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.a); } //secondbit cairo_move_to(this->cr,partextents.x_advance+this->pad,yoffset); cairo_show_text(this->cr,undercurs); //3rdbit - cairo_set_source_rgba(this->cr,0.0,0.0,0.0,1.0); + cairo_set_source_rgba(this->cr,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.a); cairo_show_text(this->cr,aftercursor); free(data); @@ -616,6 +614,15 @@ void LFSTK_lineEditClass::LFSTK_setFormatedText(const char *txt,bool replace) } } +/** +* Get the colour name for cursor. +* \return std::string Colour name. +*/ +std::string LFSTK_lineEditClass::LFSTK_getCursorColourName(void) +{ + return(this->cursorColour.name); +} + /** * Set the colour name for cursor. * \param colour Colour name. @@ -625,9 +632,7 @@ void LFSTK_lineEditClass::LFSTK_setCursorColourName(const char* colour) XColor tc; XColor sc; - if(this->cursorColour.name!=NULL) - free(this->cursorColour.name); - this->cursorColour.name=strdup(colour); + this->cursorColour.name=colour; XAllocNamedColor(this->wc->app->display,this->wc->app->cm,colour,&sc,&tc); this->cursorColour.pixel=tc.pixel; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.h index fd5e594..8850ef9 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLineEdit.h @@ -37,48 +37,49 @@ class LFSTK_lineEditClass : public LFSTK_gadgetClass ~LFSTK_lineEditClass(); LFSTK_lineEditClass(LFSTK_windowClass* parentwc,const char* label,int x,int y,unsigned w,unsigned h,int gravity=BUTTONGRAV); - void LFSTK_clearWindow(void); - void LFSTK_resizeWindow(int w,int h); + void LFSTK_clearWindow(void); + void LFSTK_resizeWindow(int w,int h); - const std::string *LFSTK_getBuffer(void); - void LFSTK_setBuffer(const char *str); + std::string LFSTK_getBuffer(void); + void LFSTK_setBuffer(const char *str); const char *LFSTK_getCStr(void); - void LFSTK_setCallbackOnReturn(bool onreturn); - bool LFSTK_getCallbackOnReturn(void); + void LFSTK_setCallbackOnReturn(bool onreturn); + bool LFSTK_getCallbackOnReturn(void); - bool mouseDown(XButtonEvent *e); - bool keyRelease(XKeyEvent *e); - bool lostFocus(XEvent *e); - bool gotFocus(XEvent *e); - bool clientMessage(XEvent *e); - void LFSTK_setFocus(void); + bool mouseDown(XButtonEvent *e); + bool keyRelease(XKeyEvent *e); + bool lostFocus(XEvent *e); + bool gotFocus(XEvent *e); + bool clientMessage(XEvent *e); + void LFSTK_setFocus(void); - void LFSTK_dropData(propertyStruct* data); - void LFSTK_setFormatedText(const char *txt,bool replace); - void LFSTK_setCursorColourName(const char* colour); + void LFSTK_dropData(propertyStruct* data); + void LFSTK_setFormatedText(const char *txt,bool replace); + void LFSTK_setCursorColourName(const char* colour); + std::string LFSTK_getCursorColourName(void); KeySym LFSTK_getKey(void); - unsigned int LFSTK_getModifier(void); + unsigned int LFSTK_getModifier(void); const char *LFSTK_getKeySym(void); protected: - colourStruct cursorColour={NULL,0,{0.0,0.0,0.0,0.8}}; + colourStruct cursorColour={"",false,0,{0,0,0,0.8}}; double charWidth; - bool startUpMDFlag=false; - bool callbackOnReturn=true; + bool startUpMDFlag=false; + bool callbackOnReturn=true; private: - void drawLabel(void); - void getClip(void); - void setOffsetcurs(int step); + void drawLabel(void); + void getClip(void); + void setOffsetcurs(int step); std::string buffer; int cursorPos=0; int visCursorPos=0; - bool isFocused=false; + bool isFocused=false; int offsetCurs=0; KeySym keysym_return; - unsigned int state; + unsigned int state; //contxt window LFSTK_windowClass *editWindow=NULL; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.cpp index 3c72731..afd41e5 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.cpp @@ -69,12 +69,16 @@ bool LFSTK_listGadgetClass::select(void *object,void* userdata) break; } - for(int j=0;jmaxShowing;j++) - { - list->labelsArray->at(j)->LFSTK_setColourName(NORMALCOLOUR,list->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPELISTTROUGHCOLOUR)); - list->labelsArray->at(j)->LFSTK_clearWindow(); - } - label->LFSTK_setColourName(NORMALCOLOUR,label->LFSTK_getColourName(ACTIVECOLOUR)); +// for(int j=0;jmaxShowing;j++) +// { +// if(list->useListItemsColour==false) +// list->labelsArray->at(j)->newGadgetBGColours[NORMALCOLOUR]=list->labelsArray->at(j)->LFSTK_setColour(list->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPELISTTROUGHCOLOUR)); +// else +// list->labelsArray->at(j)->newGadgetBGColours[NORMALCOLOUR]=list->labelsArray->at(j)->LFSTK_setColour(list->listItemsBGColour.name); +// +// list->labelsArray->at(j)->LFSTK_clearWindow(); +// } +// label->newGadgetBGColours[NORMALCOLOUR]=label->LFSTK_setColour(label->LFSTK_getColourName(ACTIVECOLOUR)); label->LFSTK_clearWindow(); list->isDoubleClick=label->isDoubleClick; @@ -179,12 +183,6 @@ void LFSTK_listGadgetClass::LFSTK_updateList(void) this->scrollBar->LFSTK_setScale(0,0); this->listCntNew=this->labelsArray->size(); - for(int j=0;jmaxShowing;j++) - { - this->labelsArray->at(j)->LFSTK_setColourName(NORMALCOLOUR,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPELISTTROUGHCOLOUR)); - this->labelsArray->at(j)->LFSTK_clearWindow(); - } - for(int j=0;jlabelsArray->size();j++) { this->labelsArray->at(j)->LFSTK_hideGadget(); @@ -252,8 +250,8 @@ void LFSTK_listGadgetClass::LFSTK_resetListHeight(int newheight) button->LFSTK_reParentWindow(this->window,1,sy); button->toParent=true; button->LFSTK_setLabelAutoColour(true); - button->LFSTK_setColourName(NORMALCOLOUR,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPELISTTROUGHCOLOUR)); - button->gadgetDetails.colour=&button->colourNames[NORMALCOLOUR]; + button->newGadgetBGColours[NORMALCOLOUR]=LFSTK_setColour(this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPELISTTROUGHCOLOUR)); + button->gadgetDetails.colour=&button->newGadgetBGColours.at(NORMALCOLOUR); button->gadgetDetails.state=NORMALCOLOUR; button->gadgetDetails.bevel=BEVELNONE; button->LFSTK_setTile(NULL,0); @@ -338,9 +336,9 @@ LFSTK_listGadgetClass::LFSTK_listGadgetClass(LFSTK_windowClass *parentwc,const c this->scrollBar->LFSTK_setValue(0); this->style=BEVELIN; - this->LFSTK_setColourName(NORMALCOLOUR,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPELISTTROUGHCOLOUR)); - this->LFSTK_setColourName(INACTIVECOLOUR,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPELISTTROUGHCOLOUR)); - this->gadgetDetails={&this->colourNames[NORMALCOLOUR],BEVELIN,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; + this->newGadgetBGColours[NORMALCOLOUR]=LFSTK_setColour(this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPELISTTROUGHCOLOUR)); + this->newGadgetBGColours[INACTIVECOLOUR]=LFSTK_setColour(this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPELISTTROUGHCOLOUR)); + this->gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELIN,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; this->clearBox(&this->gadgetDetails); } @@ -517,3 +515,36 @@ int LFSTK_listGadgetClass::LFSTK_findByLabel(const char *needle,bool select) return(-1); } +/** +* Set the colours for the list items. +* \param gadgetColourType Colour type BG/FG +* \param std::string normal Colour name. +* \param std::string prelight Colour name. +* \param std::string active Colour name. +* \param std::string inactive Colour name. +*/ +void LFSTK_listGadgetClass::LFSTK_setListItemsColours(gadgetColourType type,std::string normal,std::string prelight,std::string active,std::string inactive) +{ + for(int j=0;jmaxShowing;j++) + { + this->labelsArray->at(j)->LFSTK_setGadgetColours(type,normal,prelight,active,inactive); + this->labelsArray->at(j)->LFSTK_clearWindow(); + } +} + +/** +* Get max width of list items. +* \return with of longest item. +*/ +int LFSTK_listGadgetClass::LFSTK_getListMaxWidth(void) +{ + double largest=0; + double thiswid=0; + for(int j=0;jlistDataArray->size();j++) + { + thiswid=4+LFSTK_getTextRealWidth(this->listDataArray->at(j).label); + if(thiswid>=largest) + largest=thiswid+4;//TODO//BEVEL? + } + return((int)(largest+0.5)); +} diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.h index b518d12..a60375d 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKListGadget.h @@ -63,18 +63,21 @@ class LFSTK_listGadgetClass : public LFSTK_gadgetClass void LFSTK_appendToList(listLabelStruct data); void LFSTK_selectByIndex(int index); int LFSTK_findByLabel(const char *needle,bool select=true); - + bool mouseExit(XButtonEvent *e) {return(true);}; bool mouseEnter(XButtonEvent *e) {XSetInputFocus(this->wc->app->display,this->window,RevertToParent,CurrentTime);return(true);}; - bool mouseDown(XButtonEvent *e) {return(true);};//{XSetInputFocus(this->wc->app->display,this->window,RevertToParent,CurrentTime);return(true);}; + bool mouseDown(XButtonEvent *e) {return(true);}; bool mouseUp(XButtonEvent *e); bool keyRelease(XKeyEvent *e); void LFSTK_resetListHeight(int newheight); + int LFSTK_getListMaxWidth(void); unsigned listCntNew=0; int currentItem=0; + void LFSTK_setListItemsColours(gadgetColourType type,std::string normal,std::string prelight,std::string active,std::string inactive); + std::vector *labelsArray; std::vector *listDataArray; @@ -85,16 +88,15 @@ class LFSTK_listGadgetClass : public LFSTK_gadgetClass unsigned listOffset=0; listData *data=NULL; + void freeList(void); + void setCurrentItem(int item); + void setNavSensitive(void); - void freeList(void); - void setCurrentItem(int item); - void setNavSensitive(void); - - static bool select(void *object,void* userdata); - static bool setFocusToList(void *object,void* userdata); - static bool selectKey(void *object,void* userdata); - static bool scrollCB(void *object,void* userdata); - static bool scrollListCB(void *object,void* userdata); + static bool select(void *object,void* userdata); + static bool setFocusToList(void *object,void* userdata); + static bool selectKey(void *object,void* userdata); + static bool scrollCB(void *object,void* userdata); + static bool scrollListCB(void *object,void* userdata); }; #endif diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKMenu.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKMenu.cpp index 3aabd0c..ad766b3 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKMenu.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKMenu.cpp @@ -126,7 +126,6 @@ void LFSTK_menuClass::resizeMenu(void) this->menuHeight=regetmenh; sy=0; this->mainMenuWindow->LFSTK_resizeWindow(this->w,this->menuHeight,true); - //this->mainMenuWindow->LFSTK_resizeWindow(400,this->menuHeight,true); for (std::map::iterator it=this->mainMenuWindow->gadgetMap.begin();it!=this->mainMenuWindow->gadgetMap.end();++it) { mappedListener *ml=it->second; @@ -302,7 +301,7 @@ bool LFSTK_menuClass::menuScroll(void *object,void* userdata) for (std::map::iterator it=menuc->mainMenuWindow->gadgetMap.begin();it!=menuc->mainMenuWindow->gadgetMap.end();++it) { mappedListener *ml=it->second; - if((ml!=NULL) && (ml->type==MENUITEMGADGET))// && (ml->gadget==gadget)) + if((ml!=NULL) && (ml->type==MENUITEMGADGET)) { ml->gadget->LFSTK_getGeom(&geom); ml->gadget->LFSTK_moveGadget(geom.x,cnt+(GADGETHITE/2)); @@ -313,7 +312,7 @@ bool LFSTK_menuClass::menuScroll(void *object,void* userdata) for (std::map::iterator it=menuc->mainMenuWindow->gadgetMap.begin();it!=menuc->mainMenuWindow->gadgetMap.end();++it) { mappedListener *ml=it->second; - if((ml!=NULL) && (ml->type==MENUITEMGADGET))// && (ml->gadget==gadget)) + if((ml!=NULL) && (ml->type==MENUITEMGADGET)) { ml->gadget->LFSTK_getGeom(&geom); geom.y=geom.y-((offset)*GADGETHITE); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKMenuItem.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKMenuItem.cpp index 3081426..14048a1 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKMenuItem.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKMenuItem.cpp @@ -61,15 +61,17 @@ LFSTK_menuItemClass::LFSTK_menuItemClass(LFSTK_toolWindowClass* parentwc,LFSTK_m else this->useTile=false; - for(int j=0;jLFSTK_setFontColourName(j,this->wc->globalLib->LFSTK_getGlobalString(j,TYPEMENUITEMFONTCOLOUR),false); + this->LFSTK_setGadgetColours(GADGETBG,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPEMENUITEM), + this->wc->globalLib->LFSTK_getGlobalString(PRELIGHTCOLOUR,TYPEMENUITEM), + this->wc->globalLib->LFSTK_getGlobalString(ACTIVECOLOUR,TYPEMENUITEM), + this->wc->globalLib->LFSTK_getGlobalString(INACTIVECOLOUR,TYPEMENUITEM)); - this->LFSTK_setFontString(this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPEMENUITEMFONT),true); + this->LFSTK_setGadgetColours(GADGETFG,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPEMENUITEMFONTCOLOUR), + this->wc->globalLib->LFSTK_getGlobalString(PRELIGHTCOLOUR,TYPEMENUITEMFONTCOLOUR), + this->wc->globalLib->LFSTK_getGlobalString(ACTIVECOLOUR,TYPEMENUITEMFONTCOLOUR), + this->wc->globalLib->LFSTK_getGlobalString(INACTIVECOLOUR,TYPEMENUITEMFONTCOLOUR)); - for(int j=0;jLFSTK_setColourName(j,this->wc->globalLib->LFSTK_getGlobalString(j,TYPEMENUITEM)); - - gadgetDetails= {&this->colourNames[NORMALCOLOUR],BEVELNONE,DISCLOSURE,NORMALCOLOUR,0,true,{0,0,w,h},{(int)(w-TRIANGLESIZE-(this->pad*2)),(int)((h/2)-(TRIANGLESIZE/2)+(this->pad/2)),TRIANGLESIZE,TRIANGLESIZE},menu->hasSubMenu,false,true}; + gadgetDetails= {&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELNONE,DISCLOSURE,NORMALCOLOUR,0,true,{0,0,w,h},{(int)(w-TRIANGLESIZE-(this->pad*2)),(int)((h/2)-(TRIANGLESIZE/2)+(this->pad/2)),TRIANGLESIZE,TRIANGLESIZE},menu->hasSubMenu,false,true}; this->LFSTK_setLabelGravity(labelgrav); this->menuData=menu; this->menu=mainmenu; @@ -92,7 +94,7 @@ bool LFSTK_menuItemClass::mouseExit(XButtonEvent *e) if(strcmp(this->label,"--")==0) return(true);; - this->gadgetDetails.colour=&this->colourNames[NORMALCOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(NORMALCOLOUR); this->gadgetDetails.state=NORMALCOLOUR; this->gadgetDetails.bevel=BEVELOUT; this->LFSTK_clearWindow(); @@ -180,7 +182,8 @@ bool LFSTK_menuItemClass::mouseEnter(XButtonEvent *e) if(strcmp(this->label,"--")==0) return(true); - this->gadgetDetails.colour=&this->colourNames[PRELIGHTCOLOUR]; + //this->gadgetDetails.colour=&this->colourNames[PRELIGHTCOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(PRELIGHTCOLOUR); this->gadgetDetails.state=PRELIGHTCOLOUR; this->gadgetDetails.bevel=BEVELOUT; this->LFSTK_clearWindow(); @@ -206,8 +209,6 @@ bool LFSTK_menuItemClass::mouseEnter(XButtonEvent *e) gotsubmenu=GADGETHITE; if(this->menuData->subMenus[j]->imageType!=NOTHUMB) gotthumb=MENU; - //if(strcmp(this->menuData->subMenus[j]->label,"--")==0) - // winshrink+=(GADGETHITE-SEPARATORHITE); } if(gotthumb==MENU) maxtxtwid+=GADGETHITE+gotsubmenu; @@ -219,8 +220,6 @@ bool LFSTK_menuItemClass::mouseEnter(XButtonEvent *e) for(int j=0; jmenuData->subMenuCnt; j++) { hite=GADGETHITE; - //if(strcmp(this->menuData->subMenus[j]->label,"--")==0) - // hite=SEPARATORHITE; label=new LFSTK_menuItemClass(this->subwc,this->menu,0,sy,maxtxtwid,hite,this->menuData->subMenus[j],gotthumb); label->LFSTK_setMouseCallBack(this->callBacks.mousePressCallback,this->callBacks.mouseReleaseCallback,this->menuData->subMenus[j]->userData); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.cpp index 8183caf..c2d4b9a 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.cpp @@ -95,10 +95,12 @@ LFSTK_multiLineEditClass::LFSTK_multiLineEditClass(LFSTK_windowClass* parentwc,c this->gadgetAcceptsDnD=true; this->labelGravity=LEFT; - LFSTK_setColourName(NORMALCOLOUR,"white"); - LFSTK_setFontColourName(NORMALCOLOUR,"black",false); + + this->newGadgetBGColours[NORMALCOLOUR]=this->LFSTK_setColour("white"); + this->newGadgetFGColours[NORMALCOLOUR]=this->LFSTK_setColour("black"); this->LFSTK_setCursorColourName(this->wc->globalLib->LFSTK_getGlobalString(-1,TYPECURSORCOLOUR)); - gadgetDetails={&this->colourNames[NORMALCOLOUR],BEVELIN,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; + + gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELIN,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; this->topLine=0; this->setDisplayLines(); @@ -168,7 +170,6 @@ bool LFSTK_multiLineEditClass::lostFocus(XEvent *e) this->isFocused=false; } this->setDisplayLines(); - //this->drawText(); return(true); } @@ -207,11 +208,10 @@ void LFSTK_multiLineEditClass::LFSTK_setBuffer(const char *str) /** * Return the contents of the gadget. * \return Return's a std::string. -* \note Don't free the returned string. */ -const std::string* LFSTK_multiLineEditClass::LFSTK_getBuffer(void) +std::string LFSTK_multiLineEditClass::LFSTK_getBuffer(void) { - return(const_cast(&(this->buffer))); + return(this->buffer); } /** @@ -240,14 +240,14 @@ void LFSTK_multiLineEditClass::drawText(void) cairo_save(this->cr); cairo_reset_clip(this->cr); - cairo_set_source_rgba(this->cr,1.0,1.0,1.0,1.0); + cairo_set_source_rgba(this->cr,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.a); cairo_paint(this->cr); cairo_restore(this->cr); cairo_save(this->cr); cairo_select_font_face(this->cr,fontName,slant,weight); cairo_set_font_size(this->cr,fontSize); - cairo_set_source_rgba(this->cr,0.0,0,0,1.0); + cairo_set_source_rgba(this->cr,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.a); if(this->isFocused==true) { @@ -284,26 +284,20 @@ void LFSTK_multiLineEditClass::drawText(void) if(lines.at(j)->cursorPos!=-1) { char *data; - //char *undercurs[2]; std::string undercursstr=" "; char *aftercursor; asprintf(&data,"%s",lines.at(j)->line); - //undercurs[0]=data[lines.at(j)->cursorPos]; undercursstr[0]=data[lines.at(j)->cursorPos]; - //undercurs[1]=0; undercursstr[1]=0; - //if(undercurs[0]==0) if(undercursstr.at(0)==0) undercursstr[0]=' '; - //undercurs[0]=' '; data[lines.at(j)->cursorPos]=0; aftercursor=&data[lines.at(j)->cursorPos+1]; //1stbit cairo_show_text(this->cr,data); cairo_text_extents (this->cr,data,&partextents); - //cairo_text_extents (this->cr,undercurs,&charextents); cairo_text_extents (this->cr,undercursstr.c_str(),&charextents); cairo_set_source_rgba(this->cr,this->cursorColour.RGBAColour.r,this->cursorColour.RGBAColour.g,this->cursorColour.RGBAColour.b,this->cursorColour.RGBAColour.a); @@ -311,11 +305,10 @@ void LFSTK_multiLineEditClass::drawText(void) cairo_fill(this->cr); //secondbit cairo_move_to(this->cr,partextents.x_advance+this->pad,yoffset); - cairo_set_source_rgba(this->cr,1.0,1.0,1.0,1.0); - //cairo_show_text(this->cr,undercurs); + cairo_set_source_rgba(this->cr,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.a); cairo_show_text(this->cr,undercursstr.c_str()); //3rdbit - cairo_set_source_rgba(this->cr,0.0,0.0,0.0,1.0); + cairo_set_source_rgba(this->cr,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.a); if(lines.at(j)->cursorPosline)) cairo_show_text(this->cr,aftercursor); @@ -323,7 +316,7 @@ void LFSTK_multiLineEditClass::drawText(void) } else { - cairo_set_source_rgba(this->cr,0.0,0.0,0.0,1.0); + cairo_set_source_rgba(this->cr,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetFGColours.at(NORMALCOLOUR).RGBAColour.a); cairo_show_text(this->cr,lines.at(j)->line); } } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.h index f61b32f..912b13d 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKMultiLineEdit.h @@ -52,7 +52,7 @@ class LFSTK_multiLineEditClass : public LFSTK_lineEditClass void LFSTK_clearWindow(void); void LFSTK_resizeWindow(int w,int h); - const std::string* LFSTK_getBuffer(void); + std::string LFSTK_getBuffer(void); void LFSTK_setBuffer(const char *str); const char *LFSTK_getCStr(void); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKScrollBar.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKScrollBar.cpp index 92a7905..35ca55e 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKScrollBar.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKScrollBar.cpp @@ -93,11 +93,12 @@ LFSTK_scrollBarClass::LFSTK_scrollBarClass(LFSTK_windowClass* parentwc,bool vert this->ml->type=SCROLLBARGADGET; wc->LFSTK_addMappedListener(this->window,ml); - this->LFSTK_setColourName(NORMALCOLOUR,this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPESBTROUGHCOLOUR)); - gadgetDetails={&this->colourNames[NORMALCOLOUR],BEVELIN,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; + + this->newGadgetBGColours[NORMALCOLOUR]=this->LFSTK_setColour(this->wc->globalLib->LFSTK_getGlobalString(NORMALCOLOUR,TYPESBTROUGHCOLOUR)); + + gadgetDetails={&this->newGadgetBGColours.at(NORMALCOLOUR),BEVELIN,NOINDICATOR,NORMALCOLOUR,0,true,{0,0,w,h},{0,0,0,0},false,false,false}; this->verticalBar=vertical; - if(this->verticalBar==false) { //thumb diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKToggleButton.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKToggleButton.cpp index f15d2a4..e3631c0 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKToggleButton.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKToggleButton.cpp @@ -89,7 +89,6 @@ LFSTK_toggleButtonClass::LFSTK_toggleButtonClass(LFSTK_windowClass* parentwc,con free(pathtobit); gadgetDetails={&this->wc->windowColourNames[NORMALCOLOUR],BEVELOUT,CHECK,NORMALCOLOUR,CHECKBOXSIZE,false,{0,0,w,h},{2,(int)((h/2)-(CHECKBOXSIZE/2)),CHECKBOXSIZE,CHECKBOXSIZE},true,false,true}; - this->LFSTK_setFontColourName(0,this->wc->globalLib->LFSTK_getGlobalString(0,TYPEFONTCOLOUR),true); } /** @@ -106,7 +105,7 @@ bool LFSTK_toggleButtonClass::mouseEnter(XButtonEvent *e) if(this->boxStyle==TOGGLENORMAL) { - this->gadgetDetails.colour=&this->colourNames[PRELIGHTCOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(PRELIGHTCOLOUR); this->gadgetDetails.state=PRELIGHTCOLOUR; } else @@ -139,14 +138,14 @@ bool LFSTK_toggleButtonClass::mouseExit(XButtonEvent *e) if(this->toggleState==true) { if(this->boxStyle==TOGGLENORMAL) - this->gadgetDetails.colour=&this->colourNames[ACTIVECOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(ACTIVECOLOUR); this->gadgetDetails.state=ACTIVECOLOUR; this->gadgetDetails.bevel=BEVELIN; } else { if(this->boxStyle==TOGGLENORMAL) - this->gadgetDetails.colour=&this->colourNames[NORMALCOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(NORMALCOLOUR); this->gadgetDetails.state=NORMALCOLOUR; this->gadgetDetails.bevel=BEVELOUT; } @@ -172,7 +171,7 @@ bool LFSTK_toggleButtonClass::mouseDown(XButtonEvent *e) if(this->boxStyle==TOGGLENORMAL) { - this->gadgetDetails.colour=&this->colourNames[ACTIVECOLOUR]; + this->gadgetDetails.colour=&this->newGadgetBGColours.at(ACTIVECOLOUR); this->gadgetDetails.state=ACTIVECOLOUR; } else @@ -254,7 +253,7 @@ void LFSTK_toggleButtonClass::LFSTK_setToggleStyle(drawStyle ds) gadgetDetails.hasIndicator=false; gadgetDetails.bevel=BEVELOUT; - gadgetDetails.colour=&this->colourNames[NORMALCOLOUR]; + gadgetDetails.colour=&this->newGadgetBGColours.at(NORMALCOLOUR); gadgetDetails.reserveSpace=0; gadgetDetails.buttonTile=true; this->showIndicator=false; @@ -290,14 +289,14 @@ void LFSTK_toggleButtonClass::LFSTK_setValue(bool val) this->gadgetDetails.bevel=BEVELIN; this->gadgetDetails.state=ACTIVECOLOUR; - if(this->useImage==true) + if((this->useImage==true) && (this->boxStyle!=TOGGLENORMAL)) this->cImage=this->checkOn; } else { this->gadgetDetails.bevel=BEVELOUT; this->gadgetDetails.state=NORMALCOLOUR; - if(this->useImage==true) + if((this->useImage==true) && (this->boxStyle!=TOGGLENORMAL)) this->cImage=this->checkOff; } diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKToolWindow.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKToolWindow.cpp index 4c5b7ea..307e298 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKToolWindow.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKToolWindow.cpp @@ -137,15 +137,7 @@ LFSTK_toolWindowClass::LFSTK_toolWindowClass(Display *disp,LFSTK_windowClass *wc this->windowClassInitCommon(wi); this->gadgetMap.clear(); -// this->y=y; delete wi; - -// int trcx; -// int trcy; -// Window dw; -//XTranslateCoordinates(this->app->display,this->window,this->app->rootWindow,0,0,&trcx,&trcy,&dw); -//this->globaly=trcy; - } LFSTK_toolWindowClass::LFSTK_toolWindowClass() diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp index 7c08e02..6cd2284 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp @@ -140,9 +140,6 @@ void LFSTK_windowClass::initWindow(bool loadvars) this->isActive=true; this->useTile=false; this->gadgetMap.clear(); - //XSetBackground(this->app->display,this->gc,this->windowColourNames[NORMALCOLOUR].pixel); - //XSetBackground(this->app->display,this->gc, WhitePixel(this->app->display, 0)); - //std::cerr<windowColourNames[NORMALCOLOUR].pixel<fontString!=NULL) free(this->fontString); +//TODO// for(int j=0; jwindowColourNames[j].isValid==true) + XFreeColors(this->app->display,this->app->cm,(long unsigned int*)&this->windowColourNames[j].pixel,1,0); if(this->fontColourNames[j]!=NULL) free(this->fontColourNames[j]); - - if(this->windowColourNames[j].name!=NULL) - { - free(this->windowColourNames[j].name); - XFreeColors(this->app->display,this->app->cm,(long unsigned int*)&this->windowColourNames[j].pixel,1,0); - } } if(this->windowName!=NULL) @@ -515,16 +509,14 @@ void LFSTK_windowClass::LFSTK_setFontColourName(int p,const char *colour) * \param colour Colour name. * \note state is NORMALCOLOUR=0,PRELIGHTCOLOUR=1,ACTIVECOLOUR=2,INACTIVECOLOUR=3. */ +//TODO// void LFSTK_windowClass::LFSTK_setWindowColourName(int p,const char* colour) { XColor tc,sc; std::string str=colour; int alphaint=255; - if(this->windowColourNames[p].name!=NULL) - free(this->windowColourNames[p].name); - - this->windowColourNames[p].name=strdup(colour); + this->windowColourNames[p].name=colour; if(str.at(0)=='#') { if(str.length()>7) diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h index 0f3142c..ac9f339 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.h @@ -141,7 +141,7 @@ class LFSTK_windowClass char *fontString; char *fontColourNames[MAXCOLOURS]={NULL,}; - colourStruct windowColourNames[MAXCOLOURS]={{NULL,0,{0,0,0,0}},}; + colourStruct windowColourNames[MAXCOLOURS]={{},};// {{NULL,0,{0,0,0,0}},}; bool autoLabelColour=false; LFSTK_lib *globalLib; int x; diff --git a/LFSToolKit/examples/basic.cpp b/LFSToolKit/examples/basic.cpp index e1a48b2..0fb0e6d 100755 --- a/LFSToolKit/examples/basic.cpp +++ b/LFSToolKit/examples/basic.cpp @@ -223,6 +223,7 @@ int main(int argc, char **argv) //left leftButton=new LFSTK_buttonClass(wc,"Label Left",DIALOGMIDDLE-HALFGADGETWIDTH,sy,GADGETWIDTH,GADGETHITE); +// leftButton->LFSTK_setGadgetColourPair(NORMALCOLOUR,"#000000","red"); leftButton->LFSTK_setLabelGravity(LEFT); leftButton->LFSTK_setKeyCallBack(NULL,keyCB,USERDATA("Key Left")); leftButton->LFSTK_setMouseCallBack(NULL,mouseCB,USERDATA("Left")); diff --git a/LFSToolKit/examples/list.cpp b/LFSToolKit/examples/list.cpp index 4160cd4..342527b 100755 --- a/LFSToolKit/examples/list.cpp +++ b/LFSToolKit/examples/list.cpp @@ -103,6 +103,10 @@ int main(int argc, char **argv) //list list=new LFSTK_listGadgetClass(wc,"list",BORDER,sy,DIALOGWIDTH-(BORDER*2),GADGETHITE*5); + list->LFSTK_setListItemsColours(GADGETBG,"white","red","blue","green"); + list->LFSTK_setListItemsColours(GADGETFG,"black","white","white","black"); + list->LFSTK_setGadgetColourPair(NORMALCOLOUR,"white","black"); + hrs.push_back({0,0,DIALOGWIDTH-(BORDER*2),GADGETHITE*5,NULL}); hrs.back().gadget=list; hrs.back().gadget->toParent=true; @@ -125,18 +129,18 @@ int main(int argc, char **argv) list->LFSTK_updateList(); list->LFSTK_setMouseCallBack(NULL,select,NULL); + fprintf(stderr,"Max list item width=%i\n",list->LFSTK_getListMaxWidth()); + sy+=GADGETHITE*6; //TODO// //file list -// filelist=new LFSTK_listGadgetClass(wc,"list",BORDER,sy,DIALOGWIDTH-(BORDER*2),GADGETHITE*16,SouthGravity); filelist=new LFSTK_listGadgetClass(wc,"list",0-(DIALOGWIDTH/2)+BORDER,0-(sy+GADGETHITE*10),DIALOGWIDTH-(BORDER*2),GADGETHITE*16,SouthGravity); - //filelist=new LFSTK_listGadgetClass(wc,"list",BORDER,-sy,DIALOGWIDTH-(BORDER*2),GADGETHITE*16,SouthGravity); filelist->LFSTK_setListFromFile("/tmp/biglist",false); filelist->LFSTK_setMouseCallBack(NULL,select,USERDATA(0xdeadbeaf)); //goto end if(filelist->LFSTK_findByLabel("zcat",false)==-1) printf("Not found\n"); - + fprintf(stderr,"Max list item width=%i\n",filelist->LFSTK_getListMaxWidth()); sy+=GADGETHITE*17; //line