diff --git a/LFSDock/ChangeLog b/LFSDock/ChangeLog
index 8d2e4001..dc27df6d 100644
--- a/LFSDock/ChangeLog
+++ b/LFSDock/ChangeLog
@@ -1,4 +1,5 @@
0.2.0
+Added use end caps ( optional ) when setting BG image.
Better display of transparent BG image.
Added optional background image to dock.
Fixed finding desktop files.
diff --git a/LFSDock/LFSDock/src/globals.cpp b/LFSDock/LFSDock/src/globals.cpp
index 526afcbd..214e3eaf 100644
--- a/LFSDock/LFSDock/src/globals.cpp
+++ b/LFSDock/LFSDock/src/globals.cpp
@@ -41,6 +41,8 @@ int dockGravity=PANELSOUTH;
std::string dockTextColour="";
std::string dockBGColour="";
std::string dockBGImage="";
+std::string dockBGImageLS="";
+std::string dockBGImageRS="";
bool useBG=false;
int queueID;
@@ -61,6 +63,10 @@ LFSTK_listGadgetClass *popActionList=NULL;
bool inSomeWindow=false;
bool gotLaunchers=false;
int popActionWindowYOffset=1;
+LFSTK_buttonClass *bgrs=NULL;
+LFSTK_buttonClass *bgls=NULL;
+int sidewid=0;
+int sidehite=0;
//atoms
Atom WM_STATE=None;
@@ -330,8 +336,8 @@ void resizeDock(int wid,int hite)
{
dockWindow->LFSTK_resizeWindow(wid,hite,true);
dockBGWindow->LFSTK_resizeWindow(wid,hite,true);
- //dockBGWindow->LFSTK_clearWindow(true);
- //dockWindow->LFSTK_clearWindow(true);
+ if(bgrs!=NULL)
+ bgrs->LFSTK_moveGadget(wid-sidewid,0);
}
void moveDock(int extra)
diff --git a/LFSDock/LFSDock/src/globals.h b/LFSDock/LFSDock/src/globals.h
index 99562bdd..8a0edd1f 100644
--- a/LFSDock/LFSDock/src/globals.h
+++ b/LFSDock/LFSDock/src/globals.h
@@ -88,6 +88,8 @@ extern int dockGravity;
extern std::string dockTextColour;
extern std::string dockBGColour;
extern std::string dockBGImage;
+extern std::string dockBGImageLS;
+extern std::string dockBGImageRS;
extern bool useBG;
extern int queueID;
@@ -112,6 +114,10 @@ extern LFSTK_windowClass *popActionWindow;
extern LFSTK_listGadgetClass *popActionList;
extern bool inSomeWindow;
extern int popActionWindowYOffset;
+extern LFSTK_buttonClass *bgrs;
+extern LFSTK_buttonClass *bgls;
+extern int sidewid;
+extern int sidehite;
//atoms
extern Atom WM_STATE;
diff --git a/LFSDock/LFSDock/src/main.cpp b/LFSDock/LFSDock/src/main.cpp
index f2aaf615..fcb7b13e 100644
--- a/LFSDock/LFSDock/src/main.cpp
+++ b/LFSDock/LFSDock/src/main.cpp
@@ -217,7 +217,8 @@ int main(int argc,char **argv)
win->windowType=apc->appAtomsHashed.at(LFSTK_UtilityClass::LFSTK_hashFromKey("_NET_WM_WINDOW_TYPE_DOCK"));
win->level=ABOVEALL;
win->decorated=false;
- apc->LFSTK_addWindow(win,"DOCK");
+ //win->className="LFSDOCK";
+ apc->LFSTK_addWindow(win,"LFSDock");
dockWindow=apc->mainWindow;
dockWindow->LFSTK_initDnD(true);
@@ -323,24 +324,53 @@ int main(int argc,char **argv)
dockBGWindow=apc->windows->back().window;
apc->windows->back().showing=true;
dockBGWindow->LFSTK_setTile(dockBGImage.c_str(),-1);
-//dockBGWindow->LFSTK_setWindowPixmap(apc->globalLib->LFSTK_getWindowPixmap(apc->display,apc->rootWindow),10000,24);
moveDock(0);
resizeDock(psize,iconWidth+extraSpace);
+//max hite for end caps should be 120
+
if(useBG==true)
{
- //dockWindow->LFSTK_setTile(dockBGImage.c_str(),-1);
+ cairo_status_t st;
+ cairo_surface_t *tsfc;
+ std::string suffix=LFSTK_UtilityClass::LFSTK_deleteSuffix(&dockBGImage);
+
+ dockBGImageLS=dockBGImage+"-ls."+suffix;
+ dockBGImageRS=dockBGImage+"-rs."+suffix;
dockBGWindow->LFSTK_showWindow(true);
- //dockBGWindow->LFSTK_setKeepAbove(true);
- //dockWindow->LFSTK_setKeepAbove(true);
- }
- //else
- // dockWindow->LFSTK_setTile(NULL,0);
- //dockWindow->LFSTK_showWindow(true);
- //dockWindow->LFSTK_setKeepAbove(true);
- //dockBGWindow->LFSTK_setKeepAbove(true);
+ tsfc=apc->globalLib->LFSTK_lib::LFSTK_createSurfaceFromPath(dockBGImageLS.c_str());
+ if(tsfc!=NULL)
+ {
+//fprintf(stderr,"dock hite=%i\n",iconWidth+extraSpace);
+//fprintf(stderr,"sfc=%p\n",tsfc);
+//fprintf(stderr,"hite===%i\n",cairo_image_surface_get_height(tsfc));
+//fprintf(stderr,"wid===%i\n",cairo_image_surface_get_width(tsfc));
+ sidehite=cairo_image_surface_get_height(tsfc);
+ sidewid=cairo_image_surface_get_width(tsfc);
+ cairo_surface_destroy (tsfc);
+
+ bgls=new LFSTK_buttonClass(dockBGWindow,"",0,0,sidewid,sidehite);
+ setGadgetDetails(bgls);
+ st=bgls->LFSTK_setImageFromPath(dockBGImageLS,LEFT,false);
+ if(st!=CAIRO_STATUS_SUCCESS)
+ {
+ dockBGWindow->LFSTK_deleteGadget(bgls);
+ bgls=NULL;
+ }
+
+ bgrs=new LFSTK_buttonClass(dockBGWindow,"",psize-sidewid,0,sidewid,sidehite,NorthWestGravity);
+ setGadgetDetails(bgrs);
+ st=bgrs->LFSTK_setImageFromPath(dockBGImageRS,RIGHT,false);
+ if(st!=CAIRO_STATUS_SUCCESS)
+ {
+ dockBGWindow->LFSTK_deleteGadget(bgrs);
+ bgrs=NULL;
+ }
+ }
+
+ }
if(useTaskBar==true)
updateTaskBar(true);
diff --git a/LFSDock/README.md b/LFSDock/README.md
index e0cf9255..0d5b7297 100644
--- a/LFSDock/README.md
+++ b/LFSDock/README.md
@@ -32,8 +32,14 @@ where month is between 0 - 11 ( 0=January, 11=December ), date is 1- however man
The calendar and slider gadgets are toggles and so need to be clicked on to make the appropriate window appear/disappear.
Gadgets can be in any order you wish.
-If you set a backround image, it will be tiled over the width of the window and should be at least double the height of the dock, this is a hack for now and will be fixed later.
-Transparencies are not yet working in the BG image.
+If you set a backround image, it will be tiled over the window
+
+End caps can be optionally set and fshould be in the same folder and be the same format as the main tile image with the filenames being for instance:
+/home/keithhedger/Backgrounds/rage.png << main tile, only this path needs be set in the config file ( plaease use the lfsdockprefs app ).
+/home/keithhedger/Backgrounds/rage-ls.png << left end cap.
+/home/keithhedger/Backgrounds/rage-rs.png <
+Images can be (semi-)transparent.
+The main tile can be any size but the end caps height shoud be at least 120, the width can be any size>=1.
More gadgets to come and improvements to the graphics.
The dock looks best with a transparent background at the bottom.
diff --git a/LFSToolKit/ChangeLog b/LFSToolKit/ChangeLog
index debb969b..627f2495 100644
--- a/LFSToolKit/ChangeLog
+++ b/LFSToolKit/ChangeLog
@@ -1,4 +1,5 @@
0.6.1
+Added some extras functions to LFSTK_UtilityClass.
Vairous build files tweaks.
Added mouse enter/exit call backs to image class.
Fixed cairo surface sizes.
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp
index a9e8dfeb..bdacce1b 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.cpp
@@ -904,6 +904,7 @@ void LFSTK_gadgetClass::drawImage()
cairo_save(this->cr);
cairo_reset_clip (this->cr);
+ //if((xoffset!=0) && (yoffset!=0))
cairo_translate(this->cr,xoffset,yoffset);
cairo_set_source_surface(this->cr,this->cImage,0,0);
cairo_set_operator(this->cr,CAIRO_OPERATOR_OVER);
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h
index ef48f27a..75b2095b 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKGadget.h
@@ -183,6 +183,7 @@ class LFSTK_gadgetClass
cairo_t *cr=NULL;
cairo_surface_t *sfc=NULL;
cairo_pattern_t *pattern=NULL;
+ unsigned pad;
private:
void initGadget(void);
@@ -196,7 +197,6 @@ class LFSTK_gadgetClass
void drawIndicator(gadgetStruct* details);
bevelType getActiveBevel(void);
- unsigned pad;
geometryStruct gadgetGeom;
//font and label stuff
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp
index a3c060aa..45722619 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp
@@ -978,7 +978,7 @@ cairo_surface_t *LFSTK_lib::LFSTK_createSurfaceFromPath(const char *path)
{
cairo_status_t cs=CAIRO_STATUS_SUCCESS;
cairo_surface_t *tempimage=NULL;
- char *suffix=NULL;
+ char *suffix=NULL;
if(path==NULL)
tempimage=NULL;
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKUtilityClass.cpp b/LFSToolKit/LFSToolKit/lfstk/LFSTKUtilityClass.cpp
index bc2dc0a8..d191775e 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKUtilityClass.cpp
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKUtilityClass.cpp
@@ -196,6 +196,33 @@ bool LFSTK_UtilityClass::LFSTK_hasSuffix(std::string haystack,std::string suffix
return(false);
}
+/**
+* Get suffix of string, and return suffix.
+* \param std::string str haystack.
+* \return std::string suffix.
+*/
+std::string LFSTK_UtilityClass::LFSTK_getSuffix(std::string haystack)
+{
+ std::string::size_type found=haystack.find_last_of(".");
+ return(haystack.substr(found+1));
+}
+
+/**
+* Delete suffix of string, and return suffix.
+* \param std::string str &haystack.
+* \return std::string suffix.
+*/
+std::string LFSTK_UtilityClass::LFSTK_deleteSuffix(std::string *haystack)
+{
+ std::string suffix="";
+
+ std::string::size_type found=haystack->find_last_of(".");
+
+ suffix=haystack->substr(found+1);
+ haystack->erase(found,std::string::npos);
+ return(suffix);
+}
+
/**
* Read desktop file into std::map>
* \param std::string filepath.
diff --git a/LFSToolKit/LFSToolKit/lfstk/LFSTKUtilityClass.h b/LFSToolKit/LFSToolKit/lfstk/LFSTKUtilityClass.h
index 185dd390..6a37aa00 100644
--- a/LFSToolKit/LFSToolKit/lfstk/LFSTKUtilityClass.h
+++ b/LFSToolKit/LFSToolKit/lfstk/LFSTKUtilityClass.h
@@ -39,6 +39,8 @@ class LFSTK_UtilityClass
static std::vector LFSTK_strTok(std::string str,std::string delimiter);
static std::string LFSTK_strStr(std::string haystack,std::string needle,bool caseinsensitive=false);
static bool LFSTK_hasSuffix(std::string haystack,std::string suffix);
+ static std::string LFSTK_getSuffix(std::string haystack);
+ static std::string LFSTK_deleteSuffix(std::string *haystack);
static std::string LFSTK_strStrip(std::string haystack,std::string whitespace="\t \r\n");
static std::string LFSTK_strReplaceAllStr(std::string haystack,std::string needle,std::string newneedle,bool erase=false);
static std::string LFSTK_strReplaceAllChar(std::string haystack,std::string needle,std::string newneedle,bool erase=false);
diff --git a/LFSToolKit/examples/RunExamples.cpp b/LFSToolKit/examples/RunExamples.cpp
index 6def8c25..ecd79ba3 100755
--- a/LFSToolKit/examples/RunExamples.cpp
+++ b/LFSToolKit/examples/RunExamples.cpp
@@ -8,7 +8,7 @@ fi
(
cd ..
- make ${MAKEFLAGS:--j4}
+ make ${MAKEFLAGS:--j4} --output-sync
)
APPNAME=$(basename $0 .cpp)
diff --git a/LFSToolKit/examples/geticonpath.cpp b/LFSToolKit/examples/geticonpath.cpp
index 87e6c3ae..2d9e7650 100755
--- a/LFSToolKit/examples/geticonpath.cpp
+++ b/LFSToolKit/examples/geticonpath.cpp
@@ -49,7 +49,10 @@ bool getPath(void *p,void* ud)
iconpath=apc->globalLib->LFSTK_findThemedIcon(apc->iconThemeName,mimeEdit->LFSTK_getBuffer(),"");
if(iconpath.length()>1)
{
- printf("iconpath=%s\n",iconpath.c_str());
+ printf("Icon Path=%s\n",iconpath.c_str());
+ std::cout<<"Suffix for icon path="<LFSTK_getCStr(),fileInfoEdit->LFSTK_getCStr());
@@ -59,8 +62,10 @@ bool getPath(void *p,void* ud)
if(fileinfo.isValid==true)
{
std::cout<<"Info for file "<LFSTK_getCStr()<<":"<LFSTK_setCairoFontDataParts("B");
sy+=GADGETHITE;
- fileInfoEdit=new LFSTK_lineEditClass(wc,"index.html",BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE,BUTTONGRAV);
+ fileInfoEdit=new LFSTK_lineEditClass(wc,"geticonpath.cpp",BORDER,sy,DIALOGWIDTH-BORDER-BORDER,GADGETHITE,BUTTONGRAV);
sy+=YSPACING;
//get path to icon