diff --git a/LFSApplications/ChangeLog b/LFSApplications/ChangeLog index 6ecb88a..a073edd 100644 --- a/LFSApplications/ChangeLog +++ b/LFSApplications/ChangeLog @@ -1,4 +1,5 @@ 0.2.0 +Added background path to lfsdockprefs Fixed file seletion. Changed lfsruncommand to dialog window type. Changed lfsabout to dialog window type. diff --git a/LFSApplications/LFSApplications/src/lfsdockprefs.cpp b/LFSApplications/LFSApplications/src/lfsdockprefs.cpp index 625cec9..5f6fd19 100644 --- a/LFSApplications/LFSApplications/src/lfsdockprefs.cpp +++ b/LFSApplications/LFSApplications/src/lfsdockprefs.cpp @@ -42,12 +42,12 @@ LFSTK_buttonClass *apply=NULL; //dock data LFSTK_buttonClass *dockSize=NULL; LFSTK_lineEditClass *dockSizeEdit=NULL; -infoDataStruct **dockSizeMenuGrav=NULL; +infoDataStruct **dockSizeMenuGrav=NULL; LFSTK_menuClass *sizeMenu=NULL; LFSTK_buttonClass *dockGrav=NULL; LFSTK_lineEditClass *dockGravEdit=NULL; -infoDataStruct **dockGravMenu=NULL; +infoDataStruct **dockGravMenu=NULL; LFSTK_menuClass *gravMenu=NULL; LFSTK_lineEditClass *dockOnMonitor=NULL; @@ -59,6 +59,10 @@ LFSTK_lineEditClass *dockTextColourEdit=NULL; LFSTK_lineEditClass *dockRefreshEdit=NULL; LFSTK_toggleButtonClass *dockUseMicro=NULL; + +LFSTK_toggleButtonClass *dockUseBG=NULL; +LFSTK_lineEditClass *dockBGPathEdit=NULL; + std::map dockGravConvertToStr={{1,"North"},{2,"South"}}; std::map dockSizeConvertToStr={{1,"Small"},{2,"Medium"},{3,"Large"},{4,"Huge"}}; @@ -142,6 +146,8 @@ void getEdits(void) {LFSTK_UtilityClass::LFSTK_hashFromKey("font"),{TYPESTRING,"font",fontEdit->LFSTK_getCStr(),false,0}}, {LFSTK_UtilityClass::LFSTK_hashFromKey("refreshrate"),{TYPESTRING,"refreshrate",dockRefreshEdit->LFSTK_getCStr(),false,0}}, {LFSTK_UtilityClass::LFSTK_hashFromKey("usemicroseconds"),{TYPEBOOL,"usemicroseconds","",dockUseMicro->LFSTK_getValue(),0}}, + {LFSTK_UtilityClass::LFSTK_hashFromKey("usebg"),{TYPEBOOL,"usebg","",dockUseBG->LFSTK_getValue(),0}}, + {LFSTK_UtilityClass::LFSTK_hashFromKey("usebgpath"),{TYPESTRING,"usebgpath",dockBGPathEdit->LFSTK_getCStr(),false,0}}, }; } @@ -201,6 +207,9 @@ void setEdits(void) fontEdit->LFSTK_setBuffer(prefs.LFSTK_getCString("font")); dockRefreshEdit->LFSTK_setBuffer(prefs.LFSTK_getCString("refreshrate")); dockUseMicro->LFSTK_setValue(prefs.LFSTK_getBool("usemicroseconds")); + + dockUseBG->LFSTK_setValue(prefs.LFSTK_getBool("usebg")); + dockBGPathEdit->LFSTK_setBuffer(prefs.LFSTK_getCString("usebgpath")); } void getPrefs(void) @@ -219,6 +228,8 @@ void getPrefs(void) {LFSTK_UtilityClass::LFSTK_hashFromKey("font"),{TYPESTRING,"font","Liberation Mono:size=12",false,0}}, {LFSTK_UtilityClass::LFSTK_hashFromKey("refreshrate"),{TYPESTRING,"refreshrate","1",false,0}}, {LFSTK_UtilityClass::LFSTK_hashFromKey("usemicroseconds"),{TYPEBOOL,"usemicroseconds","",false,0}}, + {LFSTK_UtilityClass::LFSTK_hashFromKey("usebg"),{TYPEBOOL,"usebg","",false,0}}, + {LFSTK_UtilityClass::LFSTK_hashFromKey("usebgpath"),{TYPESTRING,"usebgpath","",false,0}}, }; asprintf(&env,"%s/%s",apc->configDir.c_str(),dockName.c_str()); @@ -379,6 +390,16 @@ int main(int argc, char **argv) fontEdit=new LFSTK_lineEditClass(wc,apc->globalLib->LFSTK_getGlobalString(0,TYPEFONT),BORDER+GADGETWIDTH+BORDER,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); sy+=YSPACING; +//dock back + dockUseBG=new LFSTK_toggleButtonClass(wc,"Use BG",BORDER,sy,GADGETWIDTH,GADGETHITE,BUTTONGRAV); + //dockUseBG->LFSTK_setMouseCallBack(NULL,buttonCB,(void*)toggle->LFSTK_getLabel().c_str()); + //dockUseBG->LFSTK_setMouseMoveCallBack(enterCB,exitCB,USERDATA(0)); + dockUseBG->LFSTK_setToggleStyle(TOGGLENORMAL); + dockUseBG->userData=USERDATA(1); + dockBGPathEdit=new LFSTK_lineEditClass(wc,"",BORDER+GADGETWIDTH+BORDER,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); + //dockBGPathEdit->LFSTK_setMouseCallBack(NULL,coleditCB,NULL); + sy+=YSPACING; + //dock colour label=new LFSTK_labelClass(wc,"Dock Colour",BORDER,sy,GADGETWIDTH,GADGETHITE,LEFT); dockBGColourEdit=new LFSTK_lineEditClass(wc,"",BORDER+GADGETWIDTH+BORDER,sy,GADGETWIDTH*2,GADGETHITE,BUTTONGRAV); diff --git a/LFSDock/ChangeLog b/LFSDock/ChangeLog index 8eec8f8..f6bc028 100644 --- a/LFSDock/ChangeLog +++ b/LFSDock/ChangeLog @@ -1,4 +1,5 @@ 0.2.0 +Added optional background image to dock. Fixed finding desktop files. Minor fix for launchers. Added 'Quit Dock' to lanuncher context menu. diff --git a/LFSDock/LFSDock/sources b/LFSDock/LFSDock/sources index 1876800..4d9e712 100644 --- a/LFSDock/LFSDock/sources +++ b/LFSDock/LFSDock/sources @@ -1 +1 @@ -COMMONSRC = ../src/calendar.cpp ../src/callbacks.cpp ../src/clock.cpp ../src/desktopSwitcher.cpp ../src/globals.cpp ../src/launchers.cpp ../src/main.cpp ../src/slider.cpp ../src/taskBar.cpp +COMMONSRC = ../src/globals.cpp ../src/calendar.cpp ../src/callbacks.cpp ../src/clock.cpp ../src/desktopSwitcher.cpp ../src/launchers.cpp ../src/taskBar.cpp ../src/slider.cpp ../src/main.cpp diff --git a/LFSDock/LFSDock/src/callbacks.cpp b/LFSDock/LFSDock/src/callbacks.cpp index 8becb7c..a0008bf 100644 --- a/LFSDock/LFSDock/src/callbacks.cpp +++ b/LFSDock/LFSDock/src/callbacks.cpp @@ -232,7 +232,7 @@ void setGadgetPosition(LFSTK_gadgetClass *gadg,bool active) { geometryStruct geom; - gadg->LFSTK_getGeom(&geom); + gadg->LFSTK_getGeom(&geom); if(active==true) gadg->LFSTK_moveGadget(geom.x,activeY); diff --git a/LFSDock/LFSDock/src/globals.cpp b/LFSDock/LFSDock/src/globals.cpp index f900cc0..9057ebc 100644 --- a/LFSDock/LFSDock/src/globals.cpp +++ b/LFSDock/LFSDock/src/globals.cpp @@ -40,6 +40,8 @@ int onMonitor=0; int dockGravity=PANELSOUTH; std::string dockTextColour=""; std::string dockBGColour=""; +std::string dockBGImage=""; +bool useBG=false; int queueID; msgBuffer buffer; @@ -134,10 +136,19 @@ void dropDesktopFile(const char *data,void *launcher)//TODO// void setGadgetDetails(LFSTK_gadgetClass *gadget) { gadget->LFSTK_setAlpha(1.0); - gadget->LFSTK_setTile(NULL,0); gadget->LFSTK_setStyle(BEVELNONE); - gadget->LFSTK_setGadgetColours(GADGETBG,"#00000000","#00000000","#00000000","#00000000"); - gadget-> LFSTK_setGadgetColourPair(NORMALCOLOUR,"#00000000",dockTextColour); + + if(useBG==true) + { + gadget->LFSTK_setTile(dockBGImage.c_str(),-1); + gadget->gadgetDetails.geomRelativeToMainWindow=true; + } + else + { + gadget->LFSTK_setTile(NULL,0); + gadget->LFSTK_setGadgetColours(GADGETBG,"#00000000","#00000000","#00000000","#00000000"); + gadget-> LFSTK_setGadgetColourPair(NORMALCOLOUR,"#00000000",dockTextColour); + } } /* diff --git a/LFSDock/LFSDock/src/globals.h b/LFSDock/LFSDock/src/globals.h index 816365d..82393f0 100644 --- a/LFSDock/LFSDock/src/globals.h +++ b/LFSDock/LFSDock/src/globals.h @@ -87,7 +87,8 @@ extern int onMonitor; extern int dockGravity; extern std::string dockTextColour; extern std::string dockBGColour; - +extern std::string dockBGImage; +extern bool useBG; extern int queueID; extern msgBuffer buffer; diff --git a/LFSDock/LFSDock/src/launchers.cpp b/LFSDock/LFSDock/src/launchers.cpp index 8a60c85..4908b93 100644 --- a/LFSDock/LFSDock/src/launchers.cpp +++ b/LFSDock/LFSDock/src/launchers.cpp @@ -58,6 +58,8 @@ bool launcherEnterCB(LFSTK_gadgetClass*p,void* ud) inSomeWindow=true; } + //else + // currentLauncher=NULL; return(true); } diff --git a/LFSDock/LFSDock/src/main.cpp b/LFSDock/LFSDock/src/main.cpp index 9f16aff..bea2432 100644 --- a/LFSDock/LFSDock/src/main.cpp +++ b/LFSDock/LFSDock/src/main.cpp @@ -41,6 +41,8 @@ void loadPrefs(std::string prefsfile) dockBGColour=prefs.LFSTK_getString("dockbgcolour"); refreshRate= prefs.LFSTK_getInt("refreshrate"); useMicros=prefs.LFSTK_getBool("usemicroseconds"); + useBG=prefs.LFSTK_getBool("usebg"); + dockBGImage=prefs.LFSTK_getCString("usebgpath"); } void addGadgets(void) @@ -86,7 +88,6 @@ void addGadgets(void) { taskbuttons[j]=new LFSTK_buttonClass(dockWindow,"",windowWidth+(j*(iconWidth+ICONSPACE)),normalY,iconWidth,iconHeight); setGadgetDetails(taskbuttons[j]); - // taskbuttons[j]->LFSTK_setStyle(BEVELOUT); taskbuttons[j]->LFSTK_setAlpha(1.0); taskbuttons[j]->LFSTK_setMouseCallBack(NULL,taskListCB,NULL); taskbuttons[j]->LFSTK_setMouseMoveCallBack(taskSwitcherEnterCB,taskSwitcherExitCB,NULL); @@ -197,6 +198,8 @@ int main(int argc,char **argv) {LFSTK_UtilityClass::LFSTK_hashFromKey("dockbgcolour"),{TYPESTRING,"dockbgcolour","",false,0}}, {LFSTK_UtilityClass::LFSTK_hashFromKey("refreshrate"),{TYPEINT,"refreshrate","",false,1}}, {LFSTK_UtilityClass::LFSTK_hashFromKey("usemicroseconds"),{TYPEBOOL,"usemicroseconds","",false,0}}, + {LFSTK_UtilityClass::LFSTK_hashFromKey("usebg"),{TYPEBOOL,"usebg","",false,0}}, + {LFSTK_UtilityClass::LFSTK_hashFromKey("usebgpath"),{TYPESTRING,"usebgpath","",false,0}}, }; realMainLoop=true; @@ -312,8 +315,14 @@ int main(int argc,char **argv) psize=windowWidth; dockWindow->LFSTK_resizeWindow(psize,iconWidth+extraSpace,true); + //fprintf(stderr,"wid=%i hite=%i\n",psize,iconHeight); moveDock(0); + if(useBG==true) + dockWindow->LFSTK_setTile(dockBGImage.c_str(),-1); + else + dockWindow->LFSTK_setTile(NULL,0); + dockWindow->LFSTK_showWindow(true); dockWindow->LFSTK_setKeepAbove(true); diff --git a/LFSDock/LFSDock/src/taskBar.cpp b/LFSDock/LFSDock/src/taskBar.cpp index 30e3a31..6c98b77 100644 --- a/LFSDock/LFSDock/src/taskBar.cpp +++ b/LFSDock/LFSDock/src/taskBar.cpp @@ -32,7 +32,8 @@ bool taskSwitcherExitCB(LFSTK_gadgetClass*p,void* ud) { setGadgetPosition(p,false); inSomeWindow=false; - dockWindow->LFSTK_clearWindow(true); + //dockWindow->LFSTK_clearWindow(true); + currentTask=NULL; return(true); } @@ -252,7 +253,6 @@ skiplabel: moveDock(0); dockWindow->LFSTK_resizeWindow(windowWidth,iconWidth+extraSpace,true); dockWindow->LFSTK_clearWindow(true); - //XSync(apc->display,false); return; } @@ -339,7 +339,6 @@ skiplabel: dockWindow->LFSTK_resizeWindow(windowWidth+((iconWidth+ICONSPACE)*filltasks.size()),iconWidth+extraSpace,true); oldwidth=windowWidth+(iconWidth*filltasks.size()); dockWindow->LFSTK_clearWindow(true); - //XSync(apc->display,false); } } diff --git a/LFSToolKit/ChangeLog b/LFSToolKit/ChangeLog index 8b813c1..9df23f1 100644 --- a/LFSToolKit/ChangeLog +++ b/LFSToolKit/ChangeLog @@ -1,4 +1,5 @@ 0.6.1 +Gadget and window tile fixes. Fixes to find class. Minor tweaks to LFSTKFindClass. Fixed file/folder dialogs. diff --git a/LFSToolKit/LFSToolKit/lfstk/ChooserDialog.cpp b/LFSToolKit/LFSToolKit/lfstk/ChooserDialog.cpp deleted file mode 100644 index d11f8b9..0000000 --- a/LFSToolKit/LFSToolKit/lfstk/ChooserDialog.cpp +++ /dev/null @@ -1,762 +0,0 @@ -/* - * - * ©K. D. Hedger. Sun 11 Feb 14:15:00 GMT 2024 keithdhedger@gmail.com - - * This file (ChooserDialog.cpp) is part of QT5FileDialog. - - * QT5FileDialog is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * QT5FileDialog is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with QT5FileDialog. If not, see . -*/ - -#include "ChooserDialog.h" - -chooserDialogClass::~chooserDialogClass() -{ -} - -void chooserDialogClass::setShowImagesInList(bool show) -{ - this->showThumbsInList=show; - this->setFileList(); -} - -void chooserDialogClass::setMultipleSelect(bool select) -{ - if(this->saveDialog==true) - return; - - this->useMulti=select; - if(select==true) - this->fileList.setSelectionMode(QAbstractItemView::ExtendedSelection); - else - this->fileList.setSelectionMode(QAbstractItemView::SingleSelection); -} - -QIcon chooserDialogClass::getFileIcon(QString path) -{ - QIcon icon; - QMimeDatabase db; - QString realpath(QFileInfo(path).canonicalFilePath()); - QMimeType type=db.mimeTypeForFile(realpath); - - if(type.name().compare("application/x-desktop")==0) - { - QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << "/usr/share/pixmaps"); - std::map> entrys=LFSTK_UtilityClass::LFSTK_readFullDesktopFile(path.toStdString()); - std::string e; - e=LFSTK_UtilityClass::LFSTK_getFullEntry("Desktop Entry","Icon",entrys,true); - icon=QIcon::fromTheme(e.c_str()); - } - else - { - if(type.name().contains("image")) - { - if((QFileInfo(path).size()showThumbsInList==true)) - icon=QIcon(path); - else - icon=QIcon::fromTheme(type.iconName()); - } - else - { - icon=QIcon::fromTheme(type.iconName()); - } - } - if(icon.isNull()==true) - icon=QIcon::fromTheme("application-octet-stream"); - return(icon); -} - -void chooserDialogClass::setSideListMode(QListView::ViewMode mode) -{ - this->sideList.setViewMode(mode); - this->sideList.setGridSize(QSize(96,48)); - this->sideList.setResizeMode(QListView::Adjust); -} - -void chooserDialogClass::setFileListMode(QListView::ViewMode mode) -{ - this->fileList.setViewMode(mode); -} - -void chooserDialogClass::setFileList(void) -{ - QStandardItem *item; - - this->fileListModel->clear(); - this->gFind.LFSTK_setIncludeHidden(this->showHidden); - this->gFind.LFSTK_findFiles(this->localWD.toStdString().c_str()); - this->gFind.LFSTK_sortByTypeAndName(); - - for(int j=0;jgetFileIcon(this->localWD+"/"+gFind.data.at(j).name.c_str()),QString("->%1").arg(gFind.data.at(j).name.c_str())); - item->setFont(QFont(item->font().family(),-1,QFont::Bold)); - } - else if(gFind.data.at(j).fileType==BROKENLINKTYPE) - { - item=new QStandardItem(this->getFileIcon(this->localWD+"/"+gFind.data.at(j).name.c_str()),QString("%1 - Broken Link").arg(gFind.data.at(j).name.c_str())); - item->setFont(QFont(item->font().family(),-1,QFont::Bold)); - } - else - { - item=new QStandardItem(this->getFileIcon(this->localWD+"/"+gFind.data.at(j).name.c_str()),gFind.data.at(j).name.c_str()); - } - if((gFind.data.at(j).fileType==FOLDERTYPE) || (gFind.data.at(j).fileType==FOLDERLINKTYPE)) - item->setDragEnabled(true); - else - item->setDragEnabled(false); - - item->setData(gFind.data.at(j).name.c_str(),Qt::UserRole); - item->setStatusTip(this->localWD+"/"+gFind.data.at(j).name.c_str()); - this->fileListModel->appendRow(item); - } - this->fileList.scrollToTop(); -} - -void chooserDialogClass::setSideList(void) -{ - QVariant fullFilePathData; - QStorageInfo storage; - QStandardItem *item; - QList ml=QStorageInfo::mountedVolumes(); - QString disktype; - QSettings prefs("KDHedger","ChooserDialog"); - QStringList sl=prefs.value("customfolders").toStringList(); - -///standard items - this->sideListModel->clear(); - item=new QStandardItem(QIcon::fromTheme("computer"),"Computer"); - fullFilePathData="/"; - item->setData(fullFilePathData,Qt::UserRole); - this->sideListModel->appendRow(item); - fullFilePathData=QDir::homePath(); - item=new QStandardItem(QIcon::fromTheme("user-home"),QFileInfo(QDir().homePath()).baseName()); - item->setData(fullFilePathData,Qt::UserRole); - this->sideListModel->appendRow(item); - -//recent folders - item=new QStandardItem(QIcon::fromTheme("folder-saved-search"),"Recent Folders"); - fullFilePathData=this->recentFoldersPath; - item->setData(fullFilePathData,Qt::UserRole); - this->sideListModel->appendRow(item); - -//recent files - item=new QStandardItem(QIcon::fromTheme("folder-saved-search"),"Recent Files"); - fullFilePathData=this->recentFilesPath; - item->setData(fullFilePathData,Qt::UserRole); - this->sideListModel->appendRow(item); - - item=new QStandardItem(""); - item->setEnabled(false); - this->sideListModel->appendRow(item); - -//mounted drives - for(int j=0;jsetData(fullFilePathData,Qt::UserRole); - this->sideListModel->appendRow(item); - } - } - item=new QStandardItem(""); - item->setEnabled(false); - this->sideListModel->appendRow(item); - -//favs - for(int j=0;jsetData(QFileInfo(sl.at(j)).fileName(),Qt::UserRole); - item->setStatusTip(sl.at(j)); - this->sideListModel->appendRow(item); - } -} - -void chooserDialogClass::showPreViewData(void) -{ - if(this->selectedFilePath.isEmpty()==true) - return; - - QIcon icon; - QPixmap pixmap; - QMimeDatabase db; - QString mod; - int md; - struct stat sb; - QMimeType type=db.mimeTypeForFile(this->selectedFilePath); - - this->previewMimeType.setText(type.name()); - - if(type.name().contains("image")) - { - pixmap=QIcon(this->selectedFilePath).pixmap(QSize(128,128)); - } - else - { - icon=this->getFileIcon(this->selectedFilePath); - pixmap=icon.pixmap(QSize(128,128)); - } - - this->previewIcon.setPixmap(pixmap); - this->previewSize.setText(QString("Size: %1").arg(QFileInfo(this->selectedFilePath).size())); - - if(lstat(this->selectedFilePath.toStdString().c_str(),&sb)!=-1) - { - md=sb.st_mode & 07777; - mod.setNum(md,8); - this->previewMode.setText(QString("Mode: %1").arg(mod)); - } -} - -void chooserDialogClass::selectItem(const QModelIndex &index) -{ - QString t; - t=QFileInfo(this->localWD+"/"+index.data(Qt::UserRole).toString()).absoluteFilePath(); - if(this->saveDialog==false) - { - this->filepathEdit.setText(t); - } - else - { - if(QFileInfo(t).isDir()==false) - this->filepathEdit.setText(index.data(Qt::UserRole).toString()); - } - - this->selectedFileName=index.data(Qt::UserRole).toString(); - this->selectedFilePath=t; - this->realFilePath=QFileInfo(this->selectedFilePath).canonicalFilePath(); - this->realFolderPath=QFileInfo(this->realFilePath).canonicalPath(); - this->realName=QFileInfo(this->realFilePath).fileName();; - - this->showPreViewData(); -} - -void chooserDialogClass::selectSideItem(const QModelIndex &index) -{ - QList ml=QStorageInfo::mountedVolumes(); - QStorageInfo storage; - QString disktype; - QPixmap pixmap; - QIcon icon; - QLocale locale; - QString type; - qint64 sze=0; - qint64 freeb=0; - const QAbstractItemModel *model; - QMap map; - int itemoffset=2; - - disktype="drive-harddisk"; - - switch(index.row()) - { - case 0: - disktype="computer"; - storage=ml.at(index.row()); - sze=storage.bytesTotal(); - type=storage.fileSystemType(); - freeb=storage.bytesFree(); - break; - case 1: - disktype="user-home"; - type=""; - sze=0; - freeb=0; - break; - case 2: - disktype="folder-saved-search"; - type=""; - sze=0; - freeb=0; - break; - case 3: - disktype="folder-saved-search"; - type=""; - sze=0; - freeb=0; - break; - case 4: - return; - default: - if((index.row()-itemoffset)itemData(index); - if(map.find(Qt::StatusTipRole)!=map.end()) - { - str=map[Qt::StatusTipRole].toString(); - if(str.isEmpty()==true) - return; - icon=QIcon::fromTheme("folder"); - pixmap=icon.pixmap(QSize(128,128)); - this->previewIcon.setPixmap(pixmap); - this->previewSize.setText(QString("Size: %1").arg(QFileInfo(str).size())); - this->previewMimeType.setText("inode/directory"); - if(lstat(str.toStdString().c_str(),&sb)!=-1) - { - md=sb.st_mode & 07777; - mod.setNum(md,8); - this->previewMode.setText(QString("Mode: %1").arg(mod)); - } - } - return; - } - } - icon=QIcon::fromTheme(disktype); - pixmap=icon.pixmap(QSize(128,128)); - this->previewIcon.setPixmap(pixmap); - this->previewSize.setText(QString("Size: %1").arg(locale.formattedDataSize(sze))); - this->previewMimeType.setText(QString("FS Type: %1").arg(type)); - this->previewMode.setText(QString("Free: %1").arg(locale.formattedDataSize(freeb))); -} - -void chooserDialogClass::setFavs(void) -{ - QSettings prefs("KDHedger","ChooserDialog"); - QStringList sl; - QItemSelectionModel *model; - QModelIndexList list; - QString filepath; - - this->sideList.setSelectionMode(QAbstractItemView::ExtendedSelection); - this->sideList.selectAll(); - model=this->sideList.selectionModel(); - list=model->selectedIndexes(); - - for(int j=0;jlocalWD=QFileInfo(this->localWD).absoluteFilePath(); - if(this->saveDialog==true) - { - this->selectedFilePath=QFileInfo(this->localWD+"/"+this->filepathEdit.text()).absoluteFilePath(); - this->selectedFileName=QFileInfo(this->localWD+"/"+this->filepathEdit.text()).fileName();; - - this->realName=QFileInfo(QFileInfo(this->selectedFilePath).canonicalFilePath()).fileName(); - this->realFilePath=QFileInfo(this->selectedFilePath).canonicalFilePath(); - } - else - { - this->selectedFilePath=QFileInfo(this->filepathEdit.text()).absoluteFilePath(); - this->selectedFileName=QFileInfo(this->selectedFilePath).fileName(); - - this->realFilePath=QFileInfo(QFileInfo(this->filepathEdit.text()).absoluteFilePath()).canonicalFilePath(); - this->realName=QFileInfo(this->realFilePath).fileName(); - } - - fp=QFileInfo(this->selectedFilePath).canonicalFilePath(); - if(fp.isEmpty()==false) - this->realFolderPath=QFileInfo(this->selectedFilePath).canonicalPath(); - else - this->realFolderPath=QFileInfo(this->localWD).canonicalFilePath(); - - this->fileExists=QFileInfo(this->realFilePath).exists(); - - model=this->fileList.selectionModel(); - list=model->selectedIndexes(); - this->multiFileList.clear(); - - for(int j=0;jlocalWD+"/"+list.at(j).data(Qt::UserRole).toString()).absoluteFilePath(); - if(QFileInfo(filepath).isDir()==false) - { - if(this->recentFilesPath.compare(this->localWD)==0) - { - this->multiFileList.push_back(QFileInfo(QString("%1").arg(filepath)).canonicalFilePath()); - } - else - { - this->multiFileList.push_back(filepath); - } - QFile f(filepath); - recentfiles=QString("%1/%2").arg(this->recentFilesPath).arg(list.at(j).data(Qt::UserRole).toString()); - f.link(recentfiles); - f.setFileName(this->realFolderPath); - recentfiles=QString("%1/%2").arg(this->recentFoldersPath).arg(QFileInfo(this->realFolderPath).fileName()); - f.link(recentfiles); - } - } - prefs.setValue("size",this->dialogWindow.size()); - if(this->saveDialog==true) - prefs.setValue("lastsavefolder",this->localWD); - else - prefs.setValue("lastloadfolder",this->localWD); - - this->setFavs(); -} - -void chooserDialogClass::setOverwriteWarning(bool warn) -{ - this->overwriteWarning=warn; -} - -void chooserDialogClass::addFileTypes(QString types) -{ - this->fileTypes.addItem(types); -} - -void chooserDialogClass::buildMainGui(void) -{ - QVBoxLayout *windowvlayout=new QVBoxLayout; - QVBoxLayout *filevlayout=new QVBoxLayout; - QVBoxLayout *sidevlayout=new QVBoxLayout; - QVBoxLayout *infovlayout=new QVBoxLayout; - QVBoxLayout *controlsvlayout=new QVBoxLayout; - QHBoxLayout *hlayout=new QHBoxLayout; - - this->dialogWindow.setWindowTitle("Select File"); - - this->fileListModel=new QStandardItemModel(0,1); - this->fileList.setModel(this->fileListModel); - - QObject::connect(&this->fileList,&QListView::clicked,[this](const QModelIndex &index) - { - this->selectItem(index); - }); - - QObject::connect(&this->fileList,&QListView::doubleClicked,[this](const QModelIndex &index) - { - QString t; - QString dirp; - if((this->localWD.compare("/")==0) && (index.data(Qt::UserRole).toString().compare("..")==0)) - { - this->localWD="/"; - return; - } - - if(this->localWD.compare("/")==0) - t=this->localWD+index.data(Qt::UserRole).toString(); - else - t=this->localWD+"/"+index.data(Qt::UserRole).toString(); - - if(QFileInfo(t).isDir()==true) - { - if(this->recentFoldersPath.compare(this->localWD)==0) - { - t=QFileInfo(QString("%1/%2").arg(this->recentFoldersPath).arg(index.data(Qt::UserRole).toString())).canonicalFilePath(); - } - dirp=QString("%1").arg(t); - dirp=QDir::cleanPath(dirp); - if(this->saveDialog==false) - this->filepathEdit.setText(dirp); - - this->localWD=dirp; - this->setFileList(); - if(this->filepathEdit.text().isEmpty()==false) - this->selectedFilePath=this->filepathEdit.text(); - } - else - { - if(this->recentFilesPath.compare(this->localWD)==0) - { - this->localWD=QFileInfo(QString("%1/%2").arg(this->recentFilesPath).arg(index.data(Qt::UserRole).toString())).canonicalFilePath(); - this->filepathEdit.setText(QFileInfo(QString("%1/%2").arg(this->recentFilesPath).arg(index.data(Qt::UserRole).toString())).canonicalFilePath()); - this->localWD=QFileInfo(QString("%1").arg(this->filepathEdit.text())).canonicalPath(); - } - - if((QFileInfo(this->selectedFilePath).exists()==true) && (this->overwriteWarning==true) && (this->saveDialog==true)) - { - QMessageBox::StandardButton reply=QMessageBox::question(&this->dialogWindow,"File exists","File exists! Overwrite?",QMessageBox::Yes|QMessageBox::No); - if(reply==QMessageBox::No) - return; - } - - this->setFileData(); - this->dialogWindow.hide(); - } - }); - -//sidelist - QObject::connect(&this->sideList,&QListView::clicked,[this](const QModelIndex &index) - { - this->selectSideItem(index); - }); - - QObject::connect(&this->sideList,&QListView::doubleClicked,[this](const QModelIndex &index) - { - const QAbstractItemModel *model; - model=index.model(); - QMap map(model->itemData(index)); - if(map.find(Qt::StatusTipRole)!=map.end()) - { - QString str=map[Qt::StatusTipRole].toString(); - this->localWD=QFileInfo(str).absoluteFilePath(); - } - else - this->localWD=index.data(Qt::UserRole).toString(); - this->setFileList(); - if(this->saveDialog==false) - this->filepathEdit.setText(""); - if(this->filepathEdit.text().isEmpty()==false) - this->selectedFilePath=this->filepathEdit.text(); - }); - - this->sideListModel=new QStandardItemModel(0,1); - this->sideList.setModel(this->sideListModel); - this->sideList.setEditTriggers(QAbstractItemView::NoEditTriggers); - this->fileList.setEditTriggers(QAbstractItemView::NoEditTriggers); - - sidevlayout->addWidget(&this->sideList); - QPushButton *deletefav=new QPushButton("Remove Fav"); - deletefav->setIcon(QIcon::fromTheme("stock_cancel")); - QObject::connect(deletefav,&QPushButton::clicked,[this]() - { - QModelIndex ind=this->sideList.currentIndex(); - if(ind.data(Qt::StatusTipRole).toString().isEmpty()==false) - this->sideListModel->removeRow(this->sideList.currentIndex().row()); - }); - sidevlayout->addWidget(deletefav); - - filevlayout->addWidget(&this->fileList); - - this->previewIcon.setMaximumWidth(128); - this->previewIcon.setMinimumWidth(128); - this->previewIcon.setAlignment(Qt::AlignCenter); - - hlayout->addLayout(sidevlayout,1); - hlayout->addLayout(filevlayout,3); - hlayout->addLayout(infovlayout); - - this->previewMimeType.setWordWrap(true); - infovlayout->addWidget(&this->previewIcon); - infovlayout->addWidget(&this->previewMimeType); - infovlayout->addWidget(&this->previewSize); - infovlayout->addWidget(&this->previewMode); - infovlayout->addStretch(); - - windowvlayout->addLayout(hlayout); - - controlsvlayout->addWidget(&this->filepathEdit); - QObject::connect(&this->filepathEdit,&QLineEdit::textChanged,[this](const QString &text) - { - this->selectedFilePath=text; - }); - - controlsvlayout->addWidget(&this->fileTypes); - QObject::connect(&this->fileTypes,&QComboBox::currentTextChanged,[this](const QString &text) - { - if(text.compare("All Files")==0) - this->gFind.LFSTK_setFileTypes(""); - else - this->gFind.LFSTK_setFileTypes(text.toStdString()); - this->setFileList(); - }); - - hlayout=new QHBoxLayout; - QPushButton *cancel=new QPushButton("Cancel"); - cancel->setIcon(QIcon::fromTheme("stock_cancel")); - QObject::connect(cancel,&QPushButton::clicked,[this]() - { - this->dialogWindow.hide(); - this->setFavs(); - this->valid=false; - }); - - QPushButton *hidden=new QPushButton("Hidden"); - hidden->setCheckable(true); - hidden->setIcon(QIcon::fromTheme("stock_dialog_question")); - QObject::connect(hidden,&QPushButton::clicked,[this]() - { - this->showHidden=!this->showHidden; - this->setFileList(); - }); - - QPushButton *newfolder=new QPushButton("New Folder"); - newfolder->setIcon(QIcon::fromTheme("folder-open")); - QObject::connect(newfolder,&QPushButton::clicked,[this]() - { - bool ok; - QString text=QInputDialog::getText(&this->dialogWindow,"New Folder","New folder name",QLineEdit::Normal,"New Folder",&ok); - if(ok==true) - { - QString dirpath; - QDir dirp(this->localWD); - dirp.mkdir(text); - this->localWD=QString("%1/%2").arg(this->localWD).arg(text); - if(this->saveDialog==false) - this->filepathEdit.setText(this->localWD); - this->setFileList(); - } - }); - - QPushButton *refresh=new QPushButton("Refresh"); - refresh->setIcon(QIcon::fromTheme("refresh")); - QObject::connect(refresh,&QPushButton::clicked,[this]() - { - this->setFileList(); - }); - - QPushButton *apply; - if(this->saveDialog==false) - apply=new QPushButton("Open"); - else - apply=new QPushButton("Save"); - apply->setIcon(QIcon::fromTheme("stock_apply")); - apply->setDefault(true); - - QObject::connect(apply,&QPushButton::clicked,[this]() - { - if(this->filepathEdit.text().isEmpty()==true) - return; - - if(QFileInfo(this->selectedFilePath).isDir()==true) - { - this->localWD=selectedFilePath; - this->setFileList(); - } - else - { - if(this->filepathEdit.text().isEmpty()==true) - return; - QString tp=QString("%1/%2").arg(this->localWD).arg(this->filepathEdit.text()); - if((QFileInfo(tp).exists()==true) && (this->overwriteWarning==true) && (this->saveDialog==true)) - { - QMessageBox::StandardButton reply=QMessageBox::question(&this->dialogWindow,"File exists","File exists! Overwrite?",QMessageBox::Yes|QMessageBox::No); - if(reply==QMessageBox::No) - return; - } - this->setFileData(); - this->dialogWindow.hide(); - } - }); - - hlayout->addWidget(cancel); - hlayout->addStretch(); - hlayout->addWidget(hidden); - hlayout->addStretch(); - hlayout->addWidget(newfolder); - hlayout->addStretch(); - hlayout->addWidget(refresh); - hlayout->addStretch(); - hlayout->addWidget(apply); - controlsvlayout->addLayout(hlayout); - windowvlayout->addLayout(controlsvlayout); - - this->dialogWindow.setLayout(windowvlayout); - this->setSideList(); - this->setFileList(); - if(this->saveDialog==false) - this->filepathEdit.setText(""); - else - { - this->selectedFilePath=this->localWD+"/"+this->saveName; - this->selectedFileName=this->saveName; - this->filepathEdit.setText(this->saveName); - } - this->fileList.setDragEnabled(true); - this->sideList.setAcceptDrops(true); -} - -void chooserDialogClass::setMaxRecents(int maxrecents) -{ - this->maxRecents=maxrecents+1; -} - -chooserDialogClass::chooserDialogClass(chooserDialogType type,QString name,QString startfolder) -{ - QSettings prefs("KDHedger","ChooserDialog"); - QSize geom(800,600); - QDir folders("/"); - QString command; - - this->recentFoldersPath=QString("%1/.config/KDHedger/recentfolders").arg(QDir::homePath()); - this->recentFilesPath=QString("%1/.config/KDHedger/recentfiles").arg(QDir::homePath()); - folders.mkpath(this->recentFoldersPath); - folders.mkpath(this->recentFilesPath); - - if(type==chooserDialogType::saveDialog) - { - this->saveDialog=true; - if(name.isEmpty()==false) - this->saveName=name; - else - this->saveName="Untitled"; - if(startfolder.isEmpty()==true) - this->localWD=prefs.value("lastsavefolder").toString(); - else - this->localWD=startfolder; - } - - if(type==chooserDialogType::loadDialog) - { - if(name.isEmpty()==true) - this->localWD=prefs.value("lastloadfolder").toString(); - else - this->localWD=name; - - - this->saveDialog=false; - this->saveName=""; - } - - if((this->localWD.isEmpty()==true) || (QFileInfo(this->localWD).exists()==false)) - this->localWD="/"; - - this->buildMainGui(); - geom=prefs.value("size").toSize(); - if(geom.isEmpty()==true) - geom=QSize(800,600); - this->dialogWindow.resize(geom); - - command=QString("pushd %1/;ls -t1|tail -n +%2| xargs -I {} rm '{}';popd").arg(this->recentFilesPath).arg(this->maxRecents); - system(command.toStdString().c_str()); - command=QString("pushd %1;ls -t1|tail -n +%2| xargs -I {} rm '{}';popd").arg(this->recentFoldersPath).arg(this->maxRecents); - system(command.toStdString().c_str()); -} diff --git a/LFSToolKit/LFSToolKit/lfstk/ChooserDialog.h b/LFSToolKit/LFSToolKit/lfstk/ChooserDialog.h deleted file mode 100644 index a915b9b..0000000 --- a/LFSToolKit/LFSToolKit/lfstk/ChooserDialog.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * - * ©K. D. Hedger. Sun 11 Feb 14:14:45 GMT 2024 keithdhedger@gmail.com - - * This file (ChooserDialog.h) is part of QT5FileDialog. - - * QT5FileDialog is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * QT5FileDialog is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with QT5FileDialog. If not, see . -*/ - -#ifndef _CHOOSERDIALOG_ -#define _CHOOSERDIALOG_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "LFSTKFindClass.h" -#include "LFSTKUtilityClass.h" - -#define MAXIMAGESIZETOTHUMB 2000000 - -enum class chooserDialogType{saveDialog,loadDialog}; - -class chooserDialogClass -{ - public: - chooserDialogClass(chooserDialogType type,QString savename="",QString startfolder=""); - ~chooserDialogClass(); - - QDialog dialogWindow; - QString localWD; - QString selectedFileName; - QString selectedFilePath; - QString realFolderPath; - QString realName; - QString realFilePath; - QVector multiFileList; - LFSTK_findClass gFind; - bool fileExists=false; - bool useMulti=false; - bool valid=true; - - void setSideListMode(QListView::ViewMode mode); - void setFileListMode(QListView::ViewMode mode); - void setShowImagesInList(bool show=false); - void setMultipleSelect(bool select); - void setOverwriteWarning(bool warn); - void addFileTypes(QString types); - void setMaxRecents(int maxrecents); - - private: - QLineEdit filepathEdit; - QComboBox fileTypes; - QListView fileList; - QStandardItemModel *fileListModel; - - QListView sideList; - QStandardItemModel *sideListModel; - - QLabel previewIcon; - QLabel previewMimeType; - QLabel previewSize; - QLabel previewMode; - QLabel previewFileName; - QString saveName; - - bool showHidden=false; - bool showThumbsInList=false; - bool saveDialog=false; - bool overwriteWarning=true; - QString lastSaveFolder; - QString lastLoadFolder; - int maxRecents=21; - QString recentFoldersPath; - QString recentFilesPath; - - void buildMainGui(void); - void setSideList(void); - void setFileList(void); - QIcon getFileIcon(QString path); - void selectItem(const QModelIndex &index); - void selectSideItem(const QModelIndex &index); - void showPreViewData(void); - void setFileData(void); - void setFavs(void); -}; -#endif diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp index 83f3555..9ac123b 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp @@ -354,13 +354,13 @@ void LFSTK_gadgetClass::clearBox(gadgetStruct* details) if(details->geomRelativeToMainWindow==true) this->LFSTK_getGeomWindowRelative(&geom,this->wc->window); - + cairo_save(this->cr); cairo_reset_clip(this->cr); if(details->geomRelativeToMainWindow==true) cairo_translate(this->cr,-geom.x,-geom.y); cairo_set_source(this->cr,patt); - cairo_paint(this->cr); + cairo_paint_with_alpha(this->cr,1.0); cairo_restore(this->cr); } else @@ -1560,11 +1560,18 @@ void LFSTK_gadgetClass::LFSTK_setTile(const char *path,int size) tempimage=cairo_image_surface_create_from_png(path); cs=cairo_surface_status(tempimage); } + else if((suffix!=NULL) && (strcasecmp(suffix,".jpg")==0)) + { + tempimage=this->wc->globalLib->LFSTK_cairo_image_surface_create_from_jpeg(path); + cs=cairo_surface_status(tempimage); + } else cs=CAIRO_STATUS_INVALID_FORMAT; if(cs==CAIRO_STATUS_SUCCESS) { + if((this->gadgetDetails.gadgetGeom.w!=0) && (this->gadgetDetails.gadgetGeom.h!=0)) + cairo_xlib_surface_set_size(this->sfc,cairo_image_surface_get_width(tempimage)+1,cairo_image_surface_get_height(tempimage)+1); this->pattern=cairo_pattern_create_for_surface(tempimage); cairo_surface_destroy(tempimage); cairo_pattern_set_extend(pattern,CAIRO_EXTEND_REPEAT); diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h index 6a174b2..ef48f27 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h @@ -179,6 +179,11 @@ class LFSTK_gadgetClass bool inWindow;//TODO//MMMMmmmmmmm int imageWidth=0; + + cairo_t *cr=NULL; + cairo_surface_t *sfc=NULL; + cairo_pattern_t *pattern=NULL; + private: void initGadget(void); void selectBevel(bool mousedown); @@ -215,10 +220,10 @@ class LFSTK_gadgetClass unsigned int iconSize; //graphics - cairo_t *cr=NULL; - cairo_surface_t *sfc=NULL; +// cairo_t *cr=NULL; +// cairo_surface_t *sfc=NULL; cairo_surface_t *cImage=NULL; - cairo_pattern_t *pattern=NULL; +// cairo_pattern_t *pattern=NULL; int imageHeight=0; int imageGravity=CENTRE; diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp index 1908da0..d3e9715 100644 --- a/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp +++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKWindow.cpp @@ -338,6 +338,16 @@ void LFSTK_windowClass::LFSTK_redrawAllGadgets(void) void LFSTK_windowClass::LFSTK_clearWindow(bool cleargadgets) { int state=NORMALCOLOUR; +// +// XClearWindow(this->app->display,this->window); +// cairo_save(this->cr); +// cairo_reset_clip (this->cr); +// fprintf(stderr,"--->>>here\n"); +// cairo_set_source_rgba(this->cr,1.0,1.0,1.0,1.0); +// cairo_set_operator(this->cr,CAIRO_OPERATOR_SOURCE); +// cairo_paint(this->cr); +// cairo_surface_flush (this->sfc); +// cairo_restore(this->cr); if(cleargadgets==true) this->LFSTK_redrawAllGadgets(); @@ -348,8 +358,10 @@ void LFSTK_windowClass::LFSTK_clearWindow(bool cleargadgets) if(this->isActive==false) state=INACTIVECOLOUR; + if(this->useTile==true) { + cairo_save(this->cr); cairo_reset_clip (this->cr); cairo_set_source(this->cr,this->pattern); @@ -1006,6 +1018,10 @@ void LFSTK_windowClass::LFSTK_setTile(const char *path,int size) if(cs==CAIRO_STATUS_SUCCESS) { + //if((this->gadgetDetails.gadgetGeom.w!=0) && (this->gadgetDetails.gadgetGeom.h!=0)) + if(this->sfc==NULL) + this->sfc=cairo_xlib_surface_create(this->app->display,this->window,this->visual,w,h); + cairo_xlib_surface_set_size(this->sfc,cairo_image_surface_get_width(tempimage)+1,cairo_image_surface_get_height(tempimage)+1); this->pattern=cairo_pattern_create_for_surface(tempimage); cairo_surface_destroy(tempimage); cairo_pattern_set_extend (pattern,CAIRO_EXTEND_REPEAT); diff --git a/LFSToolKit/examples/basic.cpp b/LFSToolKit/examples/basic.cpp index 4a1ab04..579797e 100755 --- a/LFSToolKit/examples/basic.cpp +++ b/LFSToolKit/examples/basic.cpp @@ -183,7 +183,7 @@ int main(int argc, char **argv) wc=apc->mainWindow; -//wc->LFSTK_setTile("/home/keithhedger/Patterns/halloweenwood.jpg",-1);//TODO//this works ?//poss set usetheme +//wc->LFSTK_setTile("/home/keithhedger/Desktop/001_wood_coldgrayfence_th.jpg",-1);//TODO//this works ?//poss set usetheme wc->LFSTK_initDnD(false); @@ -255,10 +255,19 @@ int main(int argc, char **argv) sy+=YSPACING; //left image - leftButton=new LFSTK_buttonClass(wc,"Left Label+Image",DIALOGMIDDLE-GADGETWIDTH,sy,GADGETWIDTH*2,GADGETHITE); + //leftButton=new LFSTK_buttonClass(wc,"Left Label+Image",DIALOGMIDDLE-GADGETWIDTH,sy,GADGETWIDTH*2,GADGETHITE+100); + leftButton=new LFSTK_buttonClass(wc,"Left Label+Image",DIALOGMIDDLE-GADGETWIDTH,sy,GADGETWIDTH*2,(GADGETWIDTH*2)); leftButton->LFSTK_setImageFromPath("./casper2.JPG",LEFT,true); leftButton->LFSTK_setMouseCallBack(NULL,buttonCB,USERDATA("Left Label+Image")); - sy+=YSPACING; + leftButton->LFSTK_setAlpha(1.0); + //leftButton->LFSTK_setTile("/media/LinuxData/Development/Projects/LFSDesktopProject/LFSToolKit/examples/AspellGUI.png",-1); + //leftButton->LFSTK_setTile("/home/keithhedger/Desktop/001_wood_coldgrayfence_th.jpg",-1); + leftButton->LFSTK_setTile("./t2.jpg",-1); + leftButton->gadgetDetails.geomRelativeToMainWindow=true; + //leftButton->LFSTK_setAlpha(1.0); + //fprintf(stderr,"leftButton tile=%i\n",leftButton->useTile); + sy+=YSPACING+(GADGETWIDTH*2); + //centre image centreButton=new LFSTK_buttonClass(wc,"Centre Label+Image",DIALOGMIDDLE-GADGETWIDTH,sy,GADGETWIDTH*2,GADGETHITE); centreButton->LFSTK_setImageFromPath("./casper2.JPG",LEFT,true); diff --git a/LFSToolKit/examples/t2.jpg b/LFSToolKit/examples/t2.jpg new file mode 100644 index 0000000..f4c55fc Binary files /dev/null and b/LFSToolKit/examples/t2.jpg differ diff --git a/LFSToolKit/examples/t2.png b/LFSToolKit/examples/t2.png new file mode 100644 index 0000000..8e66527 Binary files /dev/null and b/LFSToolKit/examples/t2.png differ