diff options
Diffstat (limited to 'rclua5')
-rw-r--r-- | rclua5 | 19591 |
1 files changed, 19591 insertions, 0 deletions
@@ -0,0 +1,19591 @@ +[1mdiff --git a/iup/COPYRIGHT b/iup/COPYRIGHT[m +[1mindex dd31d6c..0061f2d 100755[m +[1m--- a/iup/COPYRIGHT[m +[1m+++ b/iup/COPYRIGHT[m +[36m@@ -7,7 +7,7 @@[m [mand commercial purposes at absolutely no cost.[m + [m + ===============================================================================[m + [m +[31m-Copyright (C) 1994-2009 Tecgraf, PUC-Rio.[m +[32m+[m[32mCopyright (C) 1994-2010 Tecgraf, PUC-Rio.[m + [m + Permission is hereby granted, free of charge, to any person obtaining a copy[m + of this software and associated documentation files (the "Software"), to deal[m +[1mdiff --git a/iup/etc/iup.rc b/iup/etc/iup.rc[m +[1mindex eab8cf5..49c324d 100755[m +[1m--- a/iup/etc/iup.rc[m +[1m+++ b/iup/etc/iup.rc[m +[36m@@ -12,7 +12,7 @@[m [mBEGIN[m + VALUE "CompanyName", "Tecgraf/PUC-Rio\0"[m + VALUE "FileDescription", "IUP - Portable User Interface\0"[m + VALUE "FileVersion", "3.0.0\0"[m +[31m- VALUE "LegalCopyright", "Copyright © 1994-2009 Tecgraf, PUC-Rio.\0"[m +[32m+[m[32m VALUE "LegalCopyright", "Copyright © 1994-2010 Tecgraf, PUC-Rio.\0"[m + VALUE "OriginalFilename", "iup.dll\0"[m + VALUE "ProductName", "IUP for Windows\0"[m + VALUE "ProductVersion", "3.0.0\0"[m +[1mdiff --git a/iup/include/iup.h b/iup/include/iup.h[m +[1mindex 9913329..2d33b98 100755[m +[1m--- a/iup/include/iup.h[m +[1m+++ b/iup/include/iup.h[m +[36m@@ -19,11 +19,11 @@[m [mextern "C" {[m + [m + [m + #define IUP_NAME "IUP - Portable User Interface"[m +[31m-#define IUP_COPYRIGHT "Copyright (C) 1994-2009 Tecgraf, PUC-Rio."[m +[32m+[m[32m#define IUP_COPYRIGHT "Copyright (C) 1994-2010 Tecgraf, PUC-Rio."[m + #define IUP_DESCRIPTION "Portable toolkit for building graphical user interfaces."[m +[31m-#define IUP_VERSION "3.0" /* bug fixes are reported only by IupVersion functions */[m +[31m-#define IUP_VERSION_NUMBER 300000[m +[31m-#define IUP_VERSION_DATE "2009/10/02"[m +[32m+[m[32m#define IUP_VERSION "3.1" /* bug fixes are reported only by IupVersion functions */[m +[32m+[m[32m#define IUP_VERSION_NUMBER 301000[m +[32m+[m[32m#define IUP_VERSION_DATE "2010/04/22"[m + [m + typedef struct Ihandle_ Ihandle;[m + typedef int (*Icallback)(Ihandle*);[m +[36m@@ -38,6 +38,7 @@[m [mvoid IupImageLibOpen (void);[m + [m + int IupMainLoop (void);[m + int IupLoopStep (void);[m +[32m+[m[32mint IupLoopStepWait (void);[m + int IupMainLoopLevel (void);[m + void IupFlush (void);[m + void IupExitLoop (void);[m +[36m@@ -148,6 +149,7 @@[m [mIhandle* IupNormalizerv(Ihandle* *ih_list);[m + Ihandle* IupCbox (Ihandle* child, ...);[m + Ihandle* IupCboxv (Ihandle* *children);[m + Ihandle* IupSbox (Ihandle *child);[m +[32m+[m[32mIhandle* IupSplit (Ihandle* child1, Ihandle* child2);[m + [m + Ihandle* IupFrame (Ihandle* child);[m + [m +[36m@@ -197,12 +199,13 @@[m [mint IupTreeSetUserId(Ihandle* ih, int id, void* userid);[m + void* IupTreeGetUserId(Ihandle* ih, int id);[m + int IupTreeGetId(Ihandle* ih, void *userid);[m + [m +[31m-void IupTreeSetAttribute (Ihandle* ih, const char* name, int id, char* value);[m +[31m-void IupTreeStoreAttribute(Ihandle* ih, const char* name, int id, char* value);[m +[32m+[m[32mvoid IupTreeSetAttribute (Ihandle* ih, const char* name, int id, const char* value);[m +[32m+[m[32mvoid IupTreeStoreAttribute(Ihandle* ih, const char* name, int id, const char* value);[m + char* IupTreeGetAttribute (Ihandle* ih, const char* name, int id);[m + int IupTreeGetInt (Ihandle* ih, const char* name, int id);[m + float IupTreeGetFloat (Ihandle* ih, const char* name, int id);[m +[31m-void IupTreeSetfAttribute (Ihandle* ih, const char* name, int id, char* format, ...);[m +[32m+[m[32mvoid IupTreeSetfAttribute (Ihandle* ih, const char* name, int id, const char* format, ...);[m +[32m+[m[32mvoid IupTreeSetAttributeHandle(Ihandle* ih, const char* a, int id, Ihandle* ih_named);[m + [m + [m + /************************************************************************/[m +[36m@@ -338,7 +341,7 @@[m [mint IupMain (int argc, char** argv); /* In C++ we have to declare the prototype[m + #endif[m + [m + /******************************************************************************[m +[31m-* Copyright (C) 1994-2009 Tecgraf, PUC-Rio.[m +[32m+[m[32m* Copyright (C) 1994-2010 Tecgraf, PUC-Rio.[m + *[m + * Permission is hereby granted, free of charge, to any person obtaining[m + * a copy of this software and associated documentation files (the[m +[1mdiff --git a/iup/include/iupcbs.h b/iup/include/iupcbs.h[m +[1mindex f33166b..70d117f 100755[m +[1m--- a/iup/include/iupcbs.h[m +[1m+++ b/iup/include/iupcbs.h[m +[36m@@ -24,7 +24,7 @@[m [mtypedef int (*IFnnii)(Ihandle*, Ihandle*, int, int); /* drop_cb */[m + typedef int (*IFnnn)(Ihandle*, Ihandle*, Ihandle*); /* tabchange_cb */[m + typedef int (*IFnss)(Ihandle*, char *, char *); /* file_cb */[m + typedef int (*IFns)(Ihandle*, char *); /* multiselect_cb */[m +[31m-typedef int (*IFnis)(Ihandle*, int, char *); /* text_action, multiline_action, edit_cb, renamenode_cb, rename_cb */[m +[32m+[m[32mtypedef int (*IFnis)(Ihandle*, int, char *); /* text_action, multiline_action, edit_cb, rename_cb */[m + typedef int (*IFnsii)(Ihandle*, char*, int, int); /* list_action */[m + typedef int (*IFnsiii)(Ihandle*, char*, int, int, int); /* dropfiles_cb */[m + typedef int (*IFniis)(Ihandle*, int, int, char*); /* motion_cb, click_cb, value_edit_cb */[m +[1mdiff --git a/iup/include/iupcontrols.h b/iup/include/iupcontrols.h[m +[1mindex c7bc566..a30d407 100755[m +[1m--- a/iup/include/iupcontrols.h[m +[1m+++ b/iup/include/iupcontrols.h[m +[36m@@ -15,9 +15,6 @@[m [mextern "C" {[m + int IupControlsOpen(void);[m + void IupControlsClose(void); /* for backward compatibility only, does nothing since IUP 3 */[m + [m +[31m-void IupOldValOpen(void);[m +[31m-void IupOldTabsOpen(void);[m +[31m-[m + Ihandle* IupColorbar(void);[m + Ihandle* IupCells(void);[m + Ihandle *IupColorBrowser(void);[m +[1mdiff --git a/iup/include/iuplua.h b/iup/include/iuplua.h[m +[1mindex dc660b5..854a858 100755[m +[1m--- a/iup/include/iuplua.h[m +[1m+++ b/iup/include/iuplua.h[m +[36m@@ -23,7 +23,7 @@[m [mint iuplua_dofile (char *filename);[m + [m + #ifdef LUA_TNONE /* Lua 5 */[m + int iuplua_open(lua_State *L);[m +[31m-int iupkey_open(lua_State *L);[m +[32m+[m[32mint iupkey_open(lua_State *L); /* does nothing, kept for backward compatibility */[m + int iuplua_close(lua_State * L);[m + [m + /* utilities */[m +[1mdiff --git a/iup/mak.vc8/iupgtk.vcproj b/iup/mak.vc8/iupgtk.vcproj[m +[1mindex 5d0a8e2..9fccbb2 100755[m +[1m--- a/iup/mak.vc8/iupgtk.vcproj[m +[1m+++ b/iup/mak.vc8/iupgtk.vcproj[m +[36m@@ -143,6 +143,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\src\gtk\iupgtk_clipboard.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\src\gtk\iupgtk_colordlg.c"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc8/iuplua5.vcproj b/iup/mak.vc8/iuplua5.vcproj[m +[1mindex 0c62f76..1245e86 100755[m +[1m--- a/iup/mak.vc8/iuplua5.vcproj[m +[1m+++ b/iup/mak.vc8/iuplua5.vcproj[m +[36m@@ -123,6 +123,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\srclua5\il_clipboard.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\srclua5\il_colordlg.c"[m + >[m + </File>[m +[36m@@ -307,6 +311,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\srclua5\clipboard.lua"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\srclua5\colordlg.lua"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc8/iupmot.vcproj b/iup/mak.vc8/iupmot.vcproj[m +[1mindex aedd67e..d2d1780 100755[m +[1m--- a/iup/mak.vc8/iupmot.vcproj[m +[1m+++ b/iup/mak.vc8/iupmot.vcproj[m +[36m@@ -161,6 +161,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\src\mot\iupmot_clipboard.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\src\mot\iupmot_colordlg.c"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc8/iupsample.vcproj b/iup/mak.vc8/iupsample.vcproj[m +[1mindex bddc4f6..dde33fd 100755[m +[1m--- a/iup/mak.vc8/iupsample.vcproj[m +[1m+++ b/iup/mak.vc8/iupsample.vcproj[m +[36m@@ -616,6 +616,13 @@[m + <File[m + RelativePath="..\html\examples\C\sample.c"[m + >[m +[32m+[m [32m<FileConfiguration[m +[32m+[m [32mName="Debug|Win32"[m +[32m+[m [32m>[m +[32m+[m [32m<Tool[m +[32m+[m [32mName="VCCLCompilerTool"[m +[32m+[m [32m/>[m +[32m+[m [32m</FileConfiguration>[m + </File>[m + <File[m + RelativePath="..\html\examples\C\sbox1.c"[m +[1mdiff --git a/iup/mak.vc8/iupsamplegtk.vcproj b/iup/mak.vc8/iupsamplegtk.vcproj[m +[1mindex b4792dd..290a86e 100755[m +[1m--- a/iup/mak.vc8/iupsamplegtk.vcproj[m +[1m+++ b/iup/mak.vc8/iupsamplegtk.vcproj[m +[36m@@ -435,6 +435,14 @@[m + <File[m + RelativePath="..\html\examples\C\list1.c"[m + >[m +[32m+[m [32m<FileConfiguration[m +[32m+[m [32mName="Debug|Win32"[m +[32m+[m [32mExcludedFromBuild="true"[m +[32m+[m [32m>[m +[32m+[m [32m<Tool[m +[32m+[m [32mName="VCCLCompilerTool"[m +[32m+[m [32m/>[m +[32m+[m [32m</FileConfiguration>[m + </File>[m + <File[m + RelativePath="..\html\examples\C\list2.c"[m +[36m@@ -777,7 +785,6 @@[m + >[m + <FileConfiguration[m + Name="Debug|Win32"[m +[31m- ExcludedFromBuild="true"[m + >[m + <Tool[m + Name="VCCLCompilerTool"[m +[1mdiff --git a/iup/mak.vc8/iuptest.vcproj b/iup/mak.vc8/iuptest.vcproj[m +[1mindex 375d83f..b539677 100755[m +[1m--- a/iup/mak.vc8/iuptest.vcproj[m +[1m+++ b/iup/mak.vc8/iuptest.vcproj[m +[36m@@ -159,6 +159,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\test\clipboard.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\test\colorbar.c"[m + >[m + </File>[m +[36m@@ -255,6 +259,14 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\test\sbox.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m +[32m+[m [32mRelativePath="..\test\scanf.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\test\spin.c"[m + >[m + </File>[m +[36m@@ -298,6 +310,10 @@[m + RelativePath="..\test\vbox.c"[m + >[m + </File>[m +[32m+[m [32m<File[m +[32m+[m [32mRelativePath="..\test\zbox.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m + </Files>[m + <Globals>[m + </Globals>[m +[1mdiff --git a/iup/mak.vc8/iuptestgtk.vcproj b/iup/mak.vc8/iuptestgtk.vcproj[m +[1mindex 46d9e49..017bb69 100755[m +[1m--- a/iup/mak.vc8/iuptestgtk.vcproj[m +[1m+++ b/iup/mak.vc8/iuptestgtk.vcproj[m +[36m@@ -154,6 +154,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\test\clipboard.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\test\colorbar.c"[m + >[m + </File>[m +[36m@@ -246,6 +250,14 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\test\sbox.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m +[32m+[m [32mRelativePath="..\test\scanf.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\test\spin.c"[m + >[m + </File>[m +[36m@@ -289,6 +301,10 @@[m + RelativePath="..\test\vbox.c"[m + >[m + </File>[m +[32m+[m [32m<File[m +[32m+[m [32mRelativePath="..\test\zbox.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m + </Files>[m + <Globals>[m + </Globals>[m +[1mdiff --git a/iup/mak.vc8/iupwin.vcproj b/iup/mak.vc8/iupwin.vcproj[m +[1mindex c1e2434..cf53df8 100755[m +[1m--- a/iup/mak.vc8/iupwin.vcproj[m +[1m+++ b/iup/mak.vc8/iupwin.vcproj[m +[36m@@ -176,6 +176,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\src\win\iupwin_clipboard.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\src\win\iupwin_colordlg.c"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc9/iup.sln b/iup/mak.vc9/iup.sln[m +[1mindex 898c75f..47e2076 100755[m +[1m--- a/iup/mak.vc9/iup.sln[m +[1m+++ b/iup/mak.vc9/iup.sln[m +[36m@@ -95,6 +95,7 @@[m [mProject("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iuplua5_exe", "iupluaexe5.v[m + {1EBC7A53-4677-AAAA-1234-49D301F17D85} = {1EBC7A53-4677-AAAA-1234-49D301F17D85}[m + {1EBC7A53-4677-75D7-8D4A-49D301F17D85} = {1EBC7A53-4677-75D7-8D4A-49D301F17D85}[m + {1EBC7A53-4677-ADF1-8D4A-49D301F17D85} = {1EBC7A53-4677-ADF1-8D4A-49D301F17D85}[m +[32m+[m [32m{1EBC7A53-4677-FFFF-1234-49D301F17D85} = {1EBC7A53-4677-FFFF-1234-49D301F17D85}[m + {B4823266-DF8C-4EFB-91C0-C7688C234EAC} = {B4823266-DF8C-4EFB-91C0-C7688C234EAC}[m + {5EEFE977-C56D-462F-BDEE-12A5452EB8CC} = {5EEFE977-C56D-462F-BDEE-12A5452EB8CC}[m + {5EEFE977-C56D-462F-BDEE-12A5452EB8CC} = {5EEFE977-C56D-462F-BDEE-12A5452EB8CC}[m +[36m@@ -196,6 +197,8 @@[m [mProject("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iuplua5gtk_exe", "iupluaexe[m + {E251B4F4-0B0A-482B-BA18-2509ADC4B6AA} = {E251B4F4-0B0A-482B-BA18-2509ADC4B6AA}[m + EndProjectSection[m + EndProject[m +[32m+[m[32mProject("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{B24D8E0A-2EB5-4C49-A146-C0AABEF81788}"[m +[32m+[m[32mEndProject[m + Global[m + GlobalSection(SolutionConfigurationPlatforms) = preSolution[m + Debug|Win32 = Debug|Win32[m +[36m@@ -285,7 +288,6 @@[m [mGlobal[m + {2F92EC58-D94C-40BF-8C82-77607C72E1E3} = {FC52B7B5-744E-45D6-815C-3502F9D965E7}[m + {9462FDEA-3E53-4250-8710-DD50AF48607C} = {FC52B7B5-744E-45D6-815C-3502F9D965E7}[m + {C684B76D-52EC-49CE-84F2-B031509419A5} = {FC52B7B5-744E-45D6-815C-3502F9D965E7}[m +[31m- {A60D658D-766C-40DB-BAFF-59AB884D86FB} = {11041D08-354A-4300-9624-41277E67DE34}[m + {1EBC7A53-4677-4C3A-8DFF-269001F17D85} = {11041D08-354A-4300-9624-41277E67DE34}[m + {1EBC7A53-4677-4C3A-8DFF-49DFF4417D85} = {11041D08-354A-4300-9624-41277E67DE34}[m + {1EBC7A53-33FF-4C3A-8DFF-49D301F17D85} = {11041D08-354A-4300-9624-41277E67DE34}[m +[36m@@ -293,7 +295,6 @@[m [mGlobal[m + {1EBC7A53-4677-1234-DDDD-49DFF4417D85} = {11041D08-354A-4300-9624-41277E67DE34}[m + {B4823266-DF8C-4EFB-91C0-C7E78C234EAC} = {11041D08-354A-4300-9624-41277E67DE34}[m + {1EBC7A53-4677-4C3A-8DFF-49D301F17D85} = {11041D08-354A-4300-9624-41277E67DE34}[m +[31m- {A60D658D-766C-40DB-BAE4-59AB884D86FB} = {1CBEAA34-BA34-497D-A775-B9AF6F905696}[m + {1EBC7A53-4677-ADF1-8D4A-49D301F17D85} = {1CBEAA34-BA34-497D-A775-B9AF6F905696}[m + {1EBC7A53-4677-75D7-8D4A-49D301F17D85} = {1CBEAA34-BA34-497D-A775-B9AF6F905696}[m + {1EBC7A53-4677-4C3A-8D4A-49D301157985} = {1CBEAA34-BA34-497D-A775-B9AF6F905696}[m +[36m@@ -302,7 +303,12 @@[m [mGlobal[m + {B4823266-DF8C-4EFB-91C0-C7688C234EAC} = {1CBEAA34-BA34-497D-A775-B9AF6F905696}[m + {1EBC7A53-4677-4C3A-8D4A-49D301F17D85} = {1CBEAA34-BA34-497D-A775-B9AF6F905696}[m + {1EBC7A53-4677-FFFF-1234-49D301F17D85} = {1CBEAA34-BA34-497D-A775-B9AF6F905696}[m +[31m- {389DF3C9-A628-4F6D-8C52-8924FA01DE66} = {1CBEAA34-BA34-497D-A775-B9AF6F905696}[m +[32m+[m [32m{A60D658D-766C-40DB-BAFF-59AB884D86FB} = {B24D8E0A-2EB5-4C49-A146-C0AABEF81788}[m +[32m+[m [32m{A60D658D-766C-40DB-BAE4-59AB884D86FB} = {B24D8E0A-2EB5-4C49-A146-C0AABEF81788}[m +[32m+[m [32m{389DF3C9-A628-4F6D-8C52-8924FA01DE66} = {B24D8E0A-2EB5-4C49-A146-C0AABEF81788}[m +[32m+[m [32m{2F92EC58-D94C-40BF-4444-77607C72E1E3} = {B24D8E0A-2EB5-4C49-A146-C0AABEF81788}[m +[32m+[m [32m{E7D19356-B0AB-44AD-ACCB-5FFFCC4837BE} = {B24D8E0A-2EB5-4C49-A146-C0AABEF81788}[m +[32m+[m [32m{0F789DF8-22CC-4392-98DB-AC3960FAD4EA} = {B24D8E0A-2EB5-4C49-A146-C0AABEF81788}[m + EndGlobalSection[m + GlobalSection(DevPartner) = postSolution[m + EndGlobalSection[m +[1mdiff --git a/iup/mak.vc9/iupcontrols.vcproj b/iup/mak.vc9/iupcontrols.vcproj[m +[1mindex 6a452af..2a7875c 100755[m +[1m--- a/iup/mak.vc9/iupcontrols.vcproj[m +[1m+++ b/iup/mak.vc9/iupcontrols.vcproj[m +[36m@@ -311,14 +311,6 @@[m + >[m + </File>[m + <File[m +[31m- RelativePath="..\srccontrols\iup_oldtabs.c"[m +[31m- >[m +[31m- </File>[m +[31m- <File[m +[31m- RelativePath="..\srccontrols\iup_oldval.c"[m +[31m- >[m +[31m- </File>[m +[31m- <File[m + RelativePath="..\srccontrols\iupcontrols.def"[m + >[m + <FileConfiguration[m +[1mdiff --git a/iup/mak.vc9/iupcore.vcproj b/iup/mak.vc9/iupcore.vcproj[m +[1mindex fbe0017..851395e 100755[m +[1m--- a/iup/mak.vc9/iupcore.vcproj[m +[1m+++ b/iup/mak.vc9/iupcore.vcproj[m +[36m@@ -475,6 +475,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\src\iup_split.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\src\iup_tabs.c"[m + >[m + </File>[m +[36m@@ -583,17 +587,6 @@[m + >[m + </File>[m + </Filter>[m +[31m- <File[m +[31m- RelativePath="..\src\iup.def"[m +[31m- >[m +[31m- <FileConfiguration[m +[31m- Name="Debug|Win32"[m +[31m- >[m +[31m- <Tool[m +[31m- Name="VCCustomBuildTool"[m +[31m- />[m +[31m- </FileConfiguration>[m +[31m- </File>[m + </Files>[m + <Globals>[m + </Globals>[m +[1mdiff --git a/iup/mak.vc9/iupgtk.vcproj b/iup/mak.vc9/iupgtk.vcproj[m +[1mindex 17281f1..a84dd4a 100755[m +[1m--- a/iup/mak.vc9/iupgtk.vcproj[m +[1m+++ b/iup/mak.vc9/iupgtk.vcproj[m +[36m@@ -95,6 +95,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\src\gtk\iupgtk_draw.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\src\gtk\iupgtk_focus.c"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc9/iuplua3.vcproj b/iup/mak.vc9/iuplua3.vcproj[m +[1mindex 9993c1c..e46f316 100755[m +[1m--- a/iup/mak.vc9/iuplua3.vcproj[m +[1m+++ b/iup/mak.vc9/iuplua3.vcproj[m +[36m@@ -116,6 +116,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\srclua3\il_split.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\srclua3\il_tabs.c"[m + >[m + </File>[m +[36m@@ -164,6 +168,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\srclua3\split.lua"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\srclua3\tabs.lua"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc9/iuplua5.vcproj b/iup/mak.vc9/iuplua5.vcproj[m +[1mindex 17d9a55..ad13650 100755[m +[1m--- a/iup/mak.vc9/iuplua5.vcproj[m +[1m+++ b/iup/mak.vc9/iuplua5.vcproj[m +[36m@@ -231,6 +231,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\srclua5\il_split.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\srclua5\il_submenu.c"[m + >[m + </File>[m +[36m@@ -407,6 +411,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\srclua5\split.lua"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\srclua5\submenu.lua"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc9/iupluaexe5.vcproj b/iup/mak.vc9/iupluaexe5.vcproj[m +[1mindex db6804a..39d15f2 100755[m +[1m--- a/iup/mak.vc9/iupluaexe5.vcproj[m +[1m+++ b/iup/mak.vc9/iupluaexe5.vcproj[m +[36m@@ -72,7 +72,7 @@[m + OutputFile="$(OutDir)/iuplua51.exe"[m + LinkIncremental="1"[m + SuppressStartupBanner="true"[m +[31m- AdditionalLibraryDirectories="..\..\im\lib;..\..\cd\lib;..\lib;..\..\lua5.1\lib\vc9;..\..\luagl\lib\static"[m +[32m+[m [32mAdditionalLibraryDirectories="..\..\im\lib;..\..\cd\lib;..\lib;..\..\lua5.1\lib\vc9;..\..\luagl\lib\static;..\..\lfs\lib\vc9"[m + GenerateManifest="false"[m + GenerateDebugInformation="true"[m + SubSystem="1"[m +[1mdiff --git a/iup/mak.vc9/iupmot.vcproj b/iup/mak.vc9/iupmot.vcproj[m +[1mindex 9bbfa5c..5c40695 100755[m +[1m--- a/iup/mak.vc9/iupmot.vcproj[m +[1m+++ b/iup/mak.vc9/iupmot.vcproj[m +[36m@@ -109,6 +109,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\src\mot\iupmot_draw.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\src\mot\iupmot_focus.c"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc9/iupsample.vcproj b/iup/mak.vc9/iupsample.vcproj[m +[1mindex 144f3ba..0e10bb6 100755[m +[1m--- a/iup/mak.vc9/iupsample.vcproj[m +[1m+++ b/iup/mak.vc9/iupsample.vcproj[m +[36m@@ -45,7 +45,7 @@[m + Optimization="0"[m + AdditionalIncludeDirectories="..\include;..\..\cd\include"[m + PreprocessorDefinitions="WIN32;_DEBUG;_WIN32_WINNT=0x0500;_WIN32_IE=0x0500;_CRT_SECURE_NO_DEPRECATE;__IUPDEF_H"[m +[31m- ExceptionHandling="0"[m +[32m+[m [32mExceptionHandling="1"[m + BasicRuntimeChecks="3"[m + RuntimeLibrary="1"[m + UsePrecompiledHeader="0"[m +[1mdiff --git a/iup/mak.vc9/iupsamplegtk.vcproj b/iup/mak.vc9/iupsamplegtk.vcproj[m +[1mindex 24da672..485b773 100755[m +[1m--- a/iup/mak.vc9/iupsamplegtk.vcproj[m +[1m+++ b/iup/mak.vc9/iupsamplegtk.vcproj[m +[36m@@ -617,7 +617,6 @@[m + >[m + <FileConfiguration[m + Name="Debug|Win32"[m +[31m- ExcludedFromBuild="true"[m + >[m + <Tool[m + Name="VCCLCompilerTool"[m +[36m@@ -785,6 +784,7 @@[m + >[m + <FileConfiguration[m + Name="Debug|Win32"[m +[32m+[m [32mExcludedFromBuild="true"[m + >[m + <Tool[m + Name="VCCLCompilerTool"[m +[1mdiff --git a/iup/mak.vc9/iuptest.vcproj b/iup/mak.vc9/iuptest.vcproj[m +[1mindex 213431c..ac8f359 100755[m +[1m--- a/iup/mak.vc9/iuptest.vcproj[m +[1m+++ b/iup/mak.vc9/iuptest.vcproj[m +[36m@@ -271,6 +271,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\test\split.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\test\sysinfo.c"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc9/iuptestgtk.vcproj b/iup/mak.vc9/iuptestgtk.vcproj[m +[1mindex 4cbc9da..d8c092c 100755[m +[1m--- a/iup/mak.vc9/iuptestgtk.vcproj[m +[1m+++ b/iup/mak.vc9/iuptestgtk.vcproj[m +[36m@@ -73,6 +73,7 @@[m + LinkIncremental="1"[m + SuppressStartupBanner="true"[m + AdditionalLibraryDirectories="..\lib;d:\lng\gtk\lib;..\..\cd\lib;D:\LNG\vld\lib"[m +[32m+[m [32mGenerateManifest="false"[m + GenerateDebugInformation="true"[m + ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"[m + SubSystem="1"[m +[36m@@ -262,6 +263,10 @@[m + >[m + </File>[m + <File[m +[32m+[m [32mRelativePath="..\test\split.c"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m +[32m+[m [32m<File[m + RelativePath="..\test\sysinfo.c"[m + >[m + </File>[m +[1mdiff --git a/iup/mak.vc9/iupwin.vcproj b/iup/mak.vc9/iupwin.vcproj[m +[1mindex 15578a9..94ef390 100755[m +[1m--- a/iup/mak.vc9/iupwin.vcproj[m +[1m+++ b/iup/mak.vc9/iupwin.vcproj[m +[36m@@ -248,6 +248,10 @@[m + >[m + </File>[m + </Filter>[m +[32m+[m [32m<File[m +[32m+[m [32mRelativePath="..\src\iup.def"[m +[32m+[m [32m>[m +[32m+[m [32m</File>[m + </Files>[m + <Globals>[m + </Globals>[m +[1mdiff --git a/iup/src/Makefile b/iup/src/Makefile[m +[1mindex 028047f..e666555 100755[m +[1m--- a/iup/src/Makefile[m +[1m+++ b/iup/src/Makefile[m +[36m@@ -1,9 +1,12 @@[m + [m +[31m-.PHONY: do_all iup iupgtk[m +[31m-do_all: iup iupgtk[m +[32m+[m[32m.PHONY: do_all iup iupgtk iupmot[m +[32m+[m[32mdo_all: iup[m + [m + iup:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak [m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m[41m [m + [m + iupgtk:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak USE_GTK=Yes[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak USE_GTK=Yes[m +[32m+[m +[32m+[m[32miupmot:[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak USE_MOTIF=Yes[m +[1mdiff --git a/iup/src/config.mak b/iup/src/config.mak[m +[1mindex e857643..82b8452 100755[m +[1m--- a/iup/src/config.mak[m +[1m+++ b/iup/src/config.mak[m +[36m@@ -2,9 +2,31 @@[m [mPROJNAME = iup[m + LIBNAME = iup[m + OPT = YES[m + [m +[31m-#ifdef DBG[m +[32m+[m[32mifdef GTK_DEFAULT[m +[32m+[m[32m ifdef USE_MOTIF[m +[32m+[m[32m # Build Motif version in Linux,Darwin,FreeBSD[m +[32m+[m[32m LIBNAME = iupmot[m +[32m+[m[32m else[m +[32m+[m[32m ifeq ($(findstring Win, $(TEC_SYSNAME)), )[m +[32m+[m[32m # Force definition if not in Windows[m +[32m+[m[32m USE_GTK = Yes[m +[32m+[m[32m endif[m +[32m+[m[32m endif[m +[32m+[m[32melse[m[41m [m +[32m+[m[32m ifdef USE_GTK[m +[32m+[m[32m # Build GTK version in IRIX,SunOS,AIX,Win32[m +[32m+[m[32m LIBNAME = iupgtk[m +[32m+[m[32m else[m +[32m+[m[32m ifeq ($(findstring Win, $(TEC_SYSNAME)), )[m +[32m+[m[32m # Force definition if not in Windows[m +[32m+[m[32m USE_MOTIF = Yes[m +[32m+[m[32m endif[m +[32m+[m[32m endif[m +[32m+[m[32mendif[m +[32m+[m +[32m+[m[32mifdef DBG[m + DEFINES += IUP_ASSERT[m +[31m-#endif [m +[32m+[m[32mendif[m[41m [m + [m + INCLUDES = ../include .[m + [m +[36m@@ -17,19 +39,14 @@[m [mSRC = iup_array.c iup_callback.c iup_dlglist.c iup_attrib.c iup_focus.c iup_font[m + iup_user.c iup_button.c iup_radio.c iup_toggle.c iup_progressbar.c iup_text.c iup_val.c \[m + iup_box.c iup_hbox.c iup_vbox.c iup_cbox.c iup_class.c iup_classbase.c iup_maskmatch.c \[m + iup_mask.c iup_maskparse.c iup_tabs.c iup_spin.c iup_list.c iup_getparam.c \[m +[31m- iup_sbox.c iup_normalizer.c iup_tree.c[m +[32m+[m[32m iup_sbox.c iup_normalizer.c iup_tree.c iup_split.c[m + [m + ifdef USE_GTK[m +[31m- ifndef GTK_DEFAULT[m +[31m- # Build GTK version in IRIX,SunOS,AIX,Win32[m +[31m- LIBNAME := iupgtk[m +[31m- endif[m +[31m-[m + DEFINES += GTK_DISABLE_DEPRECATED[m + INCLUDES += gtk[m + SRC += gtk/iupgtk_common.c gtk/iupgtk_focus.c gtk/iupgtk_font.c gtk/iupgtk_clipboard.c \[m + gtk/iupgtk_globalattrib.c gtk/iupgtk_key.c gtk/iupgtk_tips.c \[m +[31m- gtk/iupgtk_loop.c gtk/iupgtk_open.c gtk/iupgtk_messagedlg.c \[m +[32m+[m[32m gtk/iupgtk_loop.c gtk/iupgtk_open.c gtk/iupgtk_messagedlg.c gtk/iupgtk_draw.c \[m + gtk/iupgtk_dialog.c gtk/iupgtk_timer.c gtk/iupgtk_image.c gtk/iupgtk_label.c \[m + gtk/iupgtk_colordlg.c gtk/iupgtk_fontdlg.c gtk/iupgtk_filedlg.c \[m + gtk/iupgtk_button.c gtk/iupgtk_toggle.c gtk/iupgtk_progressbar.c \[m +[36m@@ -40,7 +57,11 @@[m [mifdef USE_GTK[m + DEFINES += _WIN32_WINNT=0x0500 _WIN32_IE=0x0500 WINVER=0x0500 NOTREEVIEW[m + SRC += win/iupwindows_main.c win/iupwindows_help.c win/iupwindows_info.c[m + else[m +[31m- SRC += gtk/iupgtk_help.c mot/iupunix_info.c[m +[32m+[m[32m ifdef GTK_MAC[m +[32m+[m[32m SRC += gtk/iupmac_help.c gtk/iupmac_info.c[m +[32m+[m[32m else[m +[32m+[m[32m SRC += gtk/iupgtk_help.c mot/iupunix_info.c[m +[32m+[m[32m endif[m + endif[m + [m + ifdef USE_HILDON[m +[36m@@ -49,42 +70,35 @@[m [mifdef USE_GTK[m + LIBS += hildon-1[m + endif[m + else[m +[31m- ifneq ($(findstring Win, $(TEC_SYSNAME)), )[m +[31m- [m +[31m- SRC += win/iupwin_common.c win/iupwin_brush.c win/iupwin_focus.c win/iupwin_font.c \[m +[31m- win/iupwin_globalattrib.c win/iupwin_handle.c win/iupwin_key.c \[m +[31m- win/iupwin_loop.c win/iupwin_open.c win/iupwin_tips.c win/iupwin_info.c \[m +[31m- win/iupwin_dialog.c win/iupwin_messagedlg.c win/iupwin_timer.c \[m +[31m- win/iupwin_image.c win/iupwin_label.c win/iupwin_canvas.c win/iupwin_frame.c \[m +[31m- win/iupwin_colordlg.c win/iupwin_fontdlg.c win/iupwin_filedlg.c \[m +[31m- win/iupwin_button.c win/iupwin_draw.c win/iupwin_toggle.c win/iupwin_clipboard.c \[m +[31m- win/iupwin_progressbar.c win/iupwin_text.c win/iupwin_val.c \[m +[31m- win/iupwin_tabs.c win/iupwin_menu.c win/iupwin_list.c win/iupwin_tree.c[m +[31m- [m +[31m- SRC += win/iupwindows_main.c win/iupwindows_help.c win/iupwindows_info.c[m +[31m- [m +[31m- INCLUDES += win[m +[31m- DEFINES += _WIN32_WINNT=0x0500 _WIN32_IE=0x0500 WINVER=0x0500 NOTREEVIEW[m +[31m- else[m +[31m- ifdef GTK_DEFAULT[m +[31m- # Build Motif version in Linux,Darwin,FreeBSD[m +[31m- LIBNAME := iupmot[m +[31m- endif [m +[31m- [m +[31m- SRC += mot/iupmot_common.c mot/iupmot_color.c mot/iupmot_focus.c mot/iupmot_font.c \[m +[31m- mot/iupmot_key.c mot/iupmot_loop.c mot/iupmot_open.c mot/iupmot_tips.c \[m +[31m- mot/iupmot_globalattrib.c mot/iupmot_dialog.c mot/iupmot_messagedlg.c \[m +[31m- mot/iupmot_timer.c mot/iupmot_image.c mot/iupmot_label.c mot/iupmot_canvas.c \[m +[31m- mot/iupmot_colordlg.c mot/iupmot_fontdlg.c mot/iupmot_filedlg.c mot/iupmot_frame.c \[m +[31m- mot/iupmot_button.c mot/iupmot_toggle.c mot/iupmot_progressbar.c mot/iupmot_clipboard.c \[m +[31m- mot/iupmot_text.c mot/iupmot_val.c mot/iupmot_tabs.c mot/iupmot_menu.c \[m +[31m- mot/iupmot_list.c mot/iupmot_tree.c[m +[31m- [m +[31m- SRC += mot/iupunix_help.c mot/iupunix_info.c[m +[31m- [m +[31m- INCLUDES += mot[m +[31m- USE_MOTIF=Yes [m +[31m- endif[m +[32m+[m[32mifdef USE_MOTIF[m +[32m+[m[32m SRC += mot/iupmot_common.c mot/iupmot_color.c mot/iupmot_focus.c mot/iupmot_font.c \[m +[32m+[m[32m mot/iupmot_key.c mot/iupmot_loop.c mot/iupmot_open.c mot/iupmot_tips.c \[m +[32m+[m[32m mot/iupmot_globalattrib.c mot/iupmot_dialog.c mot/iupmot_messagedlg.c mot/iupmot_draw.c \[m +[32m+[m[32m mot/iupmot_timer.c mot/iupmot_image.c mot/iupmot_label.c mot/iupmot_canvas.c \[m +[32m+[m[32m mot/iupmot_colordlg.c mot/iupmot_fontdlg.c mot/iupmot_filedlg.c mot/iupmot_frame.c \[m +[32m+[m[32m mot/iupmot_button.c mot/iupmot_toggle.c mot/iupmot_progressbar.c mot/iupmot_clipboard.c \[m +[32m+[m[32m mot/iupmot_text.c mot/iupmot_val.c mot/iupmot_tabs.c mot/iupmot_menu.c \[m +[32m+[m[32m mot/iupmot_list.c mot/iupmot_tree.c[m +[32m+[m[41m [m +[32m+[m[32m SRC += mot/iupunix_help.c mot/iupunix_info.c[m +[32m+[m +[32m+[m[32m INCLUDES += mot[m +[32m+[m[32melse[m +[32m+[m[32m SRC += win/iupwin_common.c win/iupwin_brush.c win/iupwin_focus.c win/iupwin_font.c \[m +[32m+[m[32m win/iupwin_globalattrib.c win/iupwin_handle.c win/iupwin_key.c \[m +[32m+[m[32m win/iupwin_loop.c win/iupwin_open.c win/iupwin_tips.c win/iupwin_info.c \[m +[32m+[m[32m win/iupwin_dialog.c win/iupwin_messagedlg.c win/iupwin_timer.c \[m +[32m+[m[32m win/iupwin_image.c win/iupwin_label.c win/iupwin_canvas.c win/iupwin_frame.c \[m +[32m+[m[32m win/iupwin_colordlg.c win/iupwin_fontdlg.c win/iupwin_filedlg.c \[m +[32m+[m[32m win/iupwin_button.c win/iupwin_draw.c win/iupwin_toggle.c win/iupwin_clipboard.c \[m +[32m+[m[32m win/iupwin_progressbar.c win/iupwin_text.c win/iupwin_val.c \[m +[32m+[m[32m win/iupwin_tabs.c win/iupwin_menu.c win/iupwin_list.c win/iupwin_tree.c[m +[32m+[m[41m [m +[32m+[m[32m SRC += win/iupwindows_main.c win/iupwindows_help.c win/iupwindows_info.c[m +[32m+[m +[32m+[m[32m INCLUDES += win[m +[32m+[m[32m DEFINES += _WIN32_WINNT=0x0500 _WIN32_IE=0x0500 WINVER=0x0500 NOTREEVIEW[m +[32m+[m[32mendif[m + endif[m + [m + ifeq "$(TEC_SYSNAME)" "SunOS"[m +[36m@@ -113,6 +127,6 @@[m [mifeq "$(TEC_UNAME)" "dll"[m + endif[m + [m + ifeq "$(TEC_UNAME)" "owc1"[m +[31m- # Necessary or IUP will not work in Open Watcom[m +[32m+[m[32m # Necessary or IUP 3 will not work in Open Watcom[m + DBG=Yes[m + endif[m +[1mdiff --git a/iup/src/gtk/iupgtk_button.c b/iup/src/gtk/iupgtk_button.c[m +[1mindex 18be87c..f8474ae 100755[m +[1m--- a/iup/src/gtk/iupgtk_button.c[m +[1m+++ b/iup/src/gtk/iupgtk_button.c[m +[36m@@ -150,8 +150,10 @@[m [mstatic int gtkButtonSetPaddingAttrib(Ihandle* ih, const char* value)[m + gtk_alignment_set_padding(alignment, ih->data->vert_padding, ih->data->vert_padding, [m + ih->data->horiz_padding, ih->data->horiz_padding);[m + }[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + #ifdef WIN32[m +[36m@@ -366,12 +368,12 @@[m [mstatic int gtkButtonMapMethod(Ihandle* ih)[m + ih->data->type = IUP_BUTTON_IMAGE;[m + [m + value = iupAttribGet(ih, "TITLE");[m +[31m- if (value)[m +[32m+[m[32m if (value && *value!=0)[m + {[m + GtkSettings* settings = gtk_widget_get_settings(ih->handle);[m + g_object_set(settings, "gtk-button-images", (int)TRUE, NULL);[m + [m +[31m- gtk_button_set_label((GtkButton*)ih->handle, value);[m +[32m+[m[32m gtk_button_set_label((GtkButton*)ih->handle, iupgtkStrConvertToUTF8(value));[m + ih->data->type |= IUP_BUTTON_TEXT;[m + [m + #if GTK_CHECK_VERSION(2, 10, 0)[m +[36m@@ -397,7 +399,7 @@[m [mstatic int gtkButtonMapMethod(Ihandle* ih)[m + #endif[m + }[m + else[m +[31m- gtk_button_set_label((GtkButton*)ih->handle, title);[m +[32m+[m[32m gtk_button_set_label((GtkButton*)ih->handle, iupgtkStrConvertToUTF8(title));[m + ih->data->type = IUP_BUTTON_TEXT;[m + }[m + [m +[1mdiff --git a/iup/src/gtk/iupgtk_canvas.c b/iup/src/gtk/iupgtk_canvas.c[m +[1mindex daae4ad..3af48a4 100755[m +[1m--- a/iup/src/gtk/iupgtk_canvas.c[m +[1m+++ b/iup/src/gtk/iupgtk_canvas.c[m +[36m@@ -537,8 +537,8 @@[m [mstatic int gtkCanvasMapMethod(Ihandle* ih)[m + [m + /* To receive mouse events on a drawing area, you will need to enable them. */[m + gtk_widget_add_events(ih->handle, GDK_EXPOSURE_MASK|[m +[31m- GDK_POINTER_MOTION_MASK|GDK_BUTTON_MOTION_MASK|[m +[31m- GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|[m +[32m+[m[32m GDK_POINTER_MOTION_MASK|GDK_POINTER_MOTION_HINT_MASK|[m +[32m+[m[32m GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_BUTTON_MOTION_MASK|[m + GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK|[m + GDK_ENTER_NOTIFY_MASK|GDK_LEAVE_NOTIFY_MASK|[m + GDK_FOCUS_CHANGE_MASK|GDK_STRUCTURE_MASK);[m +[36m@@ -611,14 +611,15 @@[m [mvoid iupdrvCanvasInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "YAUTOHIDE", NULL, gtkCanvasSetYAutoHideAttrib, "YES", NULL, IUPAF_DEFAULT); /* force new default value */[m + [m + iupClassRegisterAttribute(ic, "DRAWABLE", gtkCanvasGetDrawableAttrib, NULL, NULL, NULL, IUPAF_NO_STRING);[m +[31m- //iupClassRegisterAttribute(ic, "CD_GDK", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NO_INHERIT);[m + [m + /* IupCanvas Windows or X only */[m +[31m-#ifdef WIN32 [m +[31m- iupClassRegisterAttribute(ic, "HWND", iupgtkGetNativeWindowHandle, NULL, NULL, NULL, IUPAF_NO_STRING|IUPAF_NO_INHERIT);[m +[31m-#else[m +[31m- iupClassRegisterAttribute(ic, "XWINDOW", iupgtkGetNativeWindowHandle, NULL, NULL, NULL, IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m +[31m- iupClassRegisterAttribute(ic, "XDISPLAY", (IattribGetFunc)iupdrvGetDisplay, NULL, NULL, NULL, IUPAF_READONLY|IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m +[32m+[m[32m#ifndef GTK_MAC[m +[32m+[m[32m #ifdef WIN32[m[41m [m +[32m+[m[32m iupClassRegisterAttribute(ic, "HWND", iupgtkGetNativeWindowHandle, NULL, NULL, NULL, IUPAF_NO_STRING|IUPAF_NO_INHERIT);[m +[32m+[m[32m #else[m +[32m+[m[32m iupClassRegisterAttribute(ic, "XWINDOW", iupgtkGetNativeWindowHandle, NULL, NULL, NULL, IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "XDISPLAY", (IattribGetFunc)iupdrvGetDisplay, NULL, NULL, NULL, IUPAF_READONLY|IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m +[32m+[m[32m #endif[m + #endif[m + }[m + [m +[1mdiff --git a/iup/src/gtk/iupgtk_common.c b/iup/src/gtk/iupgtk_common.c[m +[1mindex 40368f2..d84c1c8 100755[m +[1m--- a/iup/src/gtk/iupgtk_common.c[m +[1m+++ b/iup/src/gtk/iupgtk_common.c[m +[36m@@ -91,13 +91,13 @@[m [mvoid iupdrvBaseUnMapMethod(Ihandle* ih)[m + gtk_widget_destroy(widget); /* To match the call to gtk_*****_new */[m + }[m + [m +[31m-void iupdrvDisplayUpdate(Ihandle *ih)[m +[32m+[m[32mvoid iupdrvPostRedraw(Ihandle *ih)[m + {[m + /* Post a REDRAW */[m + gtk_widget_queue_draw(ih->handle);[m + }[m + [m +[31m-void iupdrvDisplayRedraw(Ihandle *ih)[m +[32m+[m[32mvoid iupdrvRedrawNow(Ihandle *ih)[m + {[m + GdkWindow* window = ih->handle->window;[m + /* Post a REDRAW */[m +[36m@@ -202,7 +202,11 @@[m [mvoid iupdrvSetVisible(Ihandle* ih, int visible)[m + [m + int iupdrvIsVisible(Ihandle* ih)[m + {[m +[32m+[m[32m#if GTK_CHECK_VERSION(2, 18, 0)[m +[32m+[m[32m if (gtk_widget_get_visible(ih->handle))[m +[32m+[m[32m#else[m + if (GTK_WIDGET_VISIBLE(ih->handle))[m +[32m+[m[32m#endif[m + {[m + /* if marked as visible, since we use gtk_widget_hide and NOT gtk_widget_hide_all[m + must check its parents. */[m +[36m@@ -211,7 +215,11 @@[m [mint iupdrvIsVisible(Ihandle* ih)[m + {[m + if (parent->iclass->nativetype != IUP_TYPEVOID)[m + {[m +[32m+[m[32m#if GTK_CHECK_VERSION(2, 18, 0)[m +[32m+[m[32m if (!gtk_widget_get_visible(parent->handle))[m +[32m+[m[32m#else[m + if (!GTK_WIDGET_VISIBLE(parent->handle))[m +[32m+[m[32m#endif[m + return 0;[m + }[m + [m +[36m@@ -225,7 +233,11 @@[m [mint iupdrvIsVisible(Ihandle* ih)[m + [m + int iupdrvIsActive(Ihandle *ih)[m + {[m +[31m- return (GTK_WIDGET_IS_SENSITIVE(ih->handle));[m +[32m+[m[32m#if GTK_CHECK_VERSION(2, 18, 0)[m +[32m+[m[32m return gtk_widget_is_sensitive(ih->handle);[m +[32m+[m[32m#else[m +[32m+[m[32m return GTK_WIDGET_IS_SENSITIVE(ih->handle);[m +[32m+[m[32m#endif[m + }[m + [m + void iupdrvSetActive(Ihandle* ih, int enable)[m +[36m@@ -424,9 +436,11 @@[m [mstatic GdkCursor* gtkGetCursor(Ihandle* ih, const char* name)[m + { "RESIZE_N", GDK_TOP_SIDE},[m + { "RESIZE_S", GDK_BOTTOM_SIDE},[m + { "RESIZE_NS", GDK_SB_V_DOUBLE_ARROW},[m +[32m+[m[32m { "SPLITTER_HORIZ", GDK_SB_V_DOUBLE_ARROW},[m + { "RESIZE_W", GDK_LEFT_SIDE},[m + { "RESIZE_E", GDK_RIGHT_SIDE},[m + { "RESIZE_WE", GDK_SB_H_DOUBLE_ARROW},[m +[32m+[m[32m { "SPLITTER_VERT", GDK_SB_H_DOUBLE_ARROW},[m + { "RESIZE_NE", GDK_TOP_RIGHT_CORNER},[m + { "RESIZE_SE", GDK_BOTTOM_RIGHT_CORNER},[m + { "RESIZE_NW", GDK_TOP_LEFT_CORNER},[m +[36m@@ -571,18 +585,24 @@[m [mvoid iupdrvDrawFocusRect(Ihandle* ih, void* _gc, int x, int y, int w, int h)[m + {[m + GdkWindow* window = ih->handle->window;[m + GtkStyle *style = gtk_widget_get_style(ih->handle);[m +[32m+[m[32m#if GTK_CHECK_VERSION(2, 18, 0)[m +[32m+[m[32m GtkStateType state = gtk_widget_get_state(ih->handle);[m +[32m+[m[32m#else[m +[32m+[m[32m GtkStateType state = GTK_WIDGET_STATE(ih->handle);[m +[32m+[m[32m#endif[m +[32m+[m[32m gtk_paint_focus(style, window, state, NULL, ih->handle, NULL, x, y, w, h);[m + (void)_gc;[m +[31m-[m +[31m- gtk_paint_focus(style, window, GTK_WIDGET_STATE(ih->handle), NULL, ih->handle, NULL, x, y, w, h);[m + }[m + [m + void iupdrvBaseRegisterCommonAttrib(Iclass* ic)[m + {[m +[32m+[m[32m#ifndef GTK_MAC[m + #ifdef WIN32 [m + iupClassRegisterAttribute(ic, "HFONT", iupgtkGetFontIdAttrib, NULL, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m + #else[m + iupClassRegisterAttribute(ic, "XFONTID", iupgtkGetFontIdAttrib, NULL, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m + #endif[m +[32m+[m[32m#endif[m + iupClassRegisterAttribute(ic, "PANGOFONTDESC", iupgtkGetPangoFontDescAttrib, NULL, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m + }[m + [m +[36m@@ -789,7 +809,17 @@[m [mchar* iupgtkStrConvertFromFilename(const char* str) /* From Filename to IUP */[m + [m + gboolean iupgtkMotionNotifyEvent(GtkWidget *widget, GdkEventMotion *evt, Ihandle *ih)[m + {[m +[31m- IFniis cb = (IFniis)IupGetCallback(ih,"MOTION_CB");[m +[32m+[m[32m IFniis cb;[m +[32m+[m +[32m+[m[32m if (evt->is_hint)[m +[32m+[m[32m {[m +[32m+[m[32m int x, y;[m +[32m+[m[32m gdk_window_get_pointer(widget->window, &x, &y, NULL);[m +[32m+[m[32m evt->x = x;[m +[32m+[m[32m evt->y = y;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m cb = (IFniis)IupGetCallback(ih,"MOTION_CB");[m + if (cb)[m + {[m + char status[IUPKEY_STATUS_SIZE] = IUPKEY_STATUS_INIT;[m +[36m@@ -818,6 +848,23 @@[m [mgboolean iupgtkButtonEvent(GtkWidget *widget, GdkEventButton *evt, Ihandle *ih)[m + [m + iupgtkButtonKeySetStatus(evt->state, evt->button, status, doubleclick);[m + [m +[32m+[m[32m if (doubleclick)[m +[32m+[m[32m {[m +[32m+[m[32m /* Must compensate the fact that in GTK there is an extra button press event[m[41m [m +[32m+[m[32m when occours a double click, we compensate that completing the event[m[41m [m +[32m+[m[32m with a button release before the double click. */[m +[32m+[m +[32m+[m[32m status[5] = ' '; /* clear double click */[m +[32m+[m +[32m+[m[32m ret = cb(ih, b, 0, (int)evt->x, (int)evt->y, status); /* release */[m +[32m+[m[32m if (ret==IUP_CLOSE)[m +[32m+[m[32m IupExitLoop();[m +[32m+[m[32m else if (ret==IUP_IGNORE)[m +[32m+[m[32m return TRUE;[m +[32m+[m +[32m+[m[32m status[5] = 'D'; /* restore double click */[m +[32m+[m[32m }[m +[32m+[m + ret = cb(ih, b, press, (int)evt->x, (int)evt->y, status);[m + if (ret==IUP_CLOSE)[m + IupExitLoop();[m +[1mdiff --git a/iup/src/gtk/iupgtk_dialog.c b/iup/src/gtk/iupgtk_dialog.c[m +[1mindex 46c0ce1..ff0d8f2 100755[m +[1m--- a/iup/src/gtk/iupgtk_dialog.c[m +[1m+++ b/iup/src/gtk/iupgtk_dialog.c[m +[36m@@ -120,12 +120,13 @@[m [mvoid iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu[m + static int native_border = 0;[m + static int native_caption = 0;[m + [m +[31m- int has_caption = iupAttribGetBoolean(ih, "MAXBOX") ||[m +[31m- iupAttribGetBoolean(ih, "MINBOX") ||[m +[31m- iupAttribGetBoolean(ih, "MENUBOX") || [m +[31m- IupGetAttribute(ih, "TITLE"); /* must use IupGetAttribute to check from the native implementation */[m +[32m+[m[32m int has_titlebar = iupAttribGetBoolean(ih, "RESIZE") || /* GTK and Motif only */[m +[32m+[m[32m iupAttribGetBoolean(ih, "MAXBOX") ||[m +[32m+[m[32m iupAttribGetBoolean(ih, "MINBOX") ||[m +[32m+[m[32m iupAttribGetBoolean(ih, "MENUBOX") ||[m[41m [m +[32m+[m[32m IupGetAttribute(ih, "TITLE"); /* must use IupGetAttribute to check from the native implementation */[m + [m +[31m- int has_border = has_caption ||[m +[32m+[m[32m int has_border = has_titlebar ||[m + iupAttribGetBoolean(ih, "RESIZE") ||[m + iupAttribGetBoolean(ih, "BORDER");[m + [m +[36m@@ -147,7 +148,7 @@[m [mvoid iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu[m + *border = win_border;[m + [m + *caption = 0;[m +[31m- if (has_caption)[m +[32m+[m[32m if (has_titlebar)[m + *caption = win_caption;[m + [m + if (!native_border && *border)[m +[36m@@ -171,7 +172,7 @@[m [mvoid iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu[m + }[m + [m + *caption = 0;[m +[31m- if (has_caption)[m +[32m+[m[32m if (has_titlebar)[m + {[m + if (native_caption)[m + *caption = native_caption;[m +[36m@@ -429,6 +430,7 @@[m [mstatic int gtkDialogMapMethod(Ihandle* ih)[m + int functions = 0;[m + InativeHandle* parent;[m + GtkWidget* fixed;[m +[32m+[m[32m int has_titlebar = 0;[m + [m + #ifdef HILDON[m + if (iupAttribGetBoolean(ih, "HILDONWINDOW")) [m +[36m@@ -494,33 +496,41 @@[m [mstatic int gtkDialogMapMethod(Ihandle* ih)[m + iupAttribSetStr(ih, "MINBOX", "NO");[m + }[m + [m +[31m- if (IupGetAttribute(ih, "TITLE")) { /* must use IupGetAttribute to check from the native implementation */[m +[31m- functions |= GDK_FUNC_MOVE;[m +[31m- decorations |= GDK_DECOR_TITLE;[m +[31m- }[m +[31m-[m +[31m- if (iupAttribGetBoolean(ih, "MENUBOX")) {[m +[32m+[m[32m if (iupAttribGet(ih, "TITLE"))[m +[32m+[m[32m has_titlebar = 1;[m +[32m+[m[32m if (iupAttribGetBoolean(ih, "MENUBOX"))[m[41m [m +[32m+[m[32m {[m + functions |= GDK_FUNC_CLOSE;[m + decorations |= GDK_DECOR_MENU;[m +[32m+[m[32m has_titlebar = 1;[m + }[m +[31m-[m +[31m- if (iupAttribGetBoolean(ih, "MINBOX")) {[m +[32m+[m[32m if (iupAttribGetBoolean(ih, "MINBOX"))[m[41m [m +[32m+[m[32m {[m + functions |= GDK_FUNC_MINIMIZE;[m + decorations |= GDK_DECOR_MINIMIZE;[m +[32m+[m[32m has_titlebar = 1;[m + }[m +[31m-[m +[31m- if (iupAttribGetBoolean(ih, "MAXBOX")) {[m +[32m+[m[32m if (iupAttribGetBoolean(ih, "MAXBOX"))[m[41m [m +[32m+[m[32m {[m + functions |= GDK_FUNC_MAXIMIZE;[m + decorations |= GDK_DECOR_MAXIMIZE;[m +[32m+[m[32m has_titlebar = 1;[m + }[m +[31m-[m +[31m- if (iupAttribGetBoolean(ih, "RESIZE")) {[m +[32m+[m[32m if (iupAttribGetBoolean(ih, "RESIZE"))[m[41m [m +[32m+[m[32m {[m + functions |= GDK_FUNC_RESIZE;[m + decorations |= GDK_DECOR_RESIZEH;[m +[31m- }[m + [m +[31m- if (iupAttribGetBoolean(ih, "BORDER"))[m +[31m- decorations |= GDK_DECOR_BORDER;[m +[32m+[m[32m decorations |= GDK_DECOR_BORDER; /* has_border */[m +[32m+[m[32m }[m +[32m+[m[32m if (has_titlebar)[m +[32m+[m[32m {[m +[32m+[m[32m functions |= GDK_FUNC_MOVE;[m +[32m+[m[32m decorations |= GDK_DECOR_TITLE;[m +[32m+[m[32m gtk_window_set_title((GtkWindow*)ih->handle, "");[m +[32m+[m[32m }[m +[32m+[m[32m if (iupAttribGetBoolean(ih, "BORDER") || has_titlebar)[m +[32m+[m[32m decorations |= GDK_DECOR_BORDER; /* has_border */[m + [m + if (decorations == 0)[m + gtk_window_set_decorated((GtkWindow*)ih->handle, FALSE);[m +[36m@@ -980,11 +990,12 @@[m [mvoid iupdrvDialogInitClass(Iclass* ic)[m + iupClassRegisterCallback(ic, "TRAYCLICK_CB", "iii");[m + [m + /* Driver Dependent Attribute functions */[m +[31m-[m +[31m-#ifdef WIN32 [m +[31m- iupClassRegisterAttribute(ic, "HWND", iupgtkGetNativeWindowHandle, NULL, NULL, NULL, IUPAF_NO_STRING|IUPAF_NO_INHERIT);[m +[31m-#else[m +[31m- iupClassRegisterAttribute(ic, "XWINDOW", iupgtkGetNativeWindowHandle, NULL, NULL, NULL, IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m +[32m+[m[32m#ifndef GTK_MAC[m +[32m+[m[32m #ifdef WIN32[m[41m [m +[32m+[m[32m iupClassRegisterAttribute(ic, "HWND", iupgtkGetNativeWindowHandle, NULL, NULL, NULL, IUPAF_NO_STRING|IUPAF_NO_INHERIT);[m +[32m+[m[32m #else[m +[32m+[m[32m iupClassRegisterAttribute(ic, "XWINDOW", iupgtkGetNativeWindowHandle, NULL, NULL, NULL, IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m +[32m+[m[32m #endif[m + #endif[m + [m + /* Visual */[m +[1mdiff --git a/iup/src/gtk/iupgtk_drv.h b/iup/src/gtk/iupgtk_drv.h[m +[1mindex ade2a4a..bf567d6 100755[m +[1m--- a/iup/src/gtk/iupgtk_drv.h[m +[1m+++ b/iup/src/gtk/iupgtk_drv.h[m +[36m@@ -59,8 +59,8 @@[m [mvoid iupgtkFontUpdateObjectPangoLayout(Ihandle* ih, gpointer object);[m + /* There are PANGO_SCALE Pango units in one device unit. [m + For an output backend where a device unit is a pixel, [m + a size value of 10 * PANGO_SCALE gives 10 pixels. */[m +[31m-#define IUPGTK_PANGOUNITS2PIXELS(_x) (((_x) + PANGO_SCALE/2) / PANGO_SCALE)[m +[31m-#define IUPGTK_PIXELS2PANGOUNITS(_x) ((_x) * PANGO_SCALE)[m +[32m+[m[32m#define iupGTK_PANGOUNITS2PIXELS(_x) (((_x) + PANGO_SCALE/2) / PANGO_SCALE)[m +[32m+[m[32m#define iupGTK_PIXELS2PANGOUNITS(_x) ((_x) * PANGO_SCALE)[m + [m + [m + /* open */[m +[1mdiff --git a/iup/src/gtk/iupgtk_filedlg.c b/iup/src/gtk/iupgtk_filedlg.c[m +[1mindex 5426910..a326c72 100755[m +[1m--- a/iup/src/gtk/iupgtk_filedlg.c[m +[1m+++ b/iup/src/gtk/iupgtk_filedlg.c[m +[36m@@ -77,6 +77,8 @@[m [mstatic void gtkFileDlgGetMultipleFiles(Ihandle* ih, GSList* list)[m + cur_len = iupArrayCount(names_array);[m + all_names = iupArrayAdd(names_array, dir_len+1);[m + memcpy(all_names+cur_len, filename, dir_len);[m +[32m+[m[32m all_names[cur_len+dir_len] = '0';[m +[32m+[m[32m iupAttribStoreStr(ih, "DIRECTORY", all_names);[m + all_names[cur_len+dir_len] = '|';[m + [m + dir_len++; /* skip separator */[m +[36m@@ -101,10 +103,14 @@[m [mstatic void gtkFileDlgGetMultipleFiles(Ihandle* ih, GSList* list)[m + iupArrayDestroy(names_array);[m + }[m + [m +[31m-#ifdef WIN32[m +[31m-#include <gdk/gdkwin32.h>[m +[32m+[m[32m#ifdef GTK_MAC[m +[32m+[m[32m #include <gdk/gdk.h>[m + #else[m +[31m-#include <gdk/gdkx.h>[m +[32m+[m[32m #ifdef WIN32[m +[32m+[m[32m #include <gdk/gdkwin32.h>[m +[32m+[m[32m #else[m +[32m+[m[32m #include <gdk/gdkx.h>[m +[32m+[m[32m #endif[m + #endif[m + [m + static void gtkFileDlgUpdatePreviewGLCanvas(Ihandle* ih)[m +[36m@@ -112,10 +118,12 @@[m [mstatic void gtkFileDlgUpdatePreviewGLCanvas(Ihandle* ih)[m + Ihandle* glcanvas = IupGetAttributeHandle(ih, "PREVIEWGLCANVAS");[m + if (glcanvas)[m + {[m +[31m-#ifdef WIN32 [m +[31m- iupAttribSetStr(glcanvas, "HWND", iupAttribGet(ih, "HWND"));[m +[31m-#else[m +[31m- iupAttribSetStr(glcanvas, "XWINDOW", iupAttribGet(ih, "XWINDOW"));[m +[32m+[m[32m#ifndef GTK_MAC[m +[32m+[m[32m #ifdef WIN32[m[41m [m +[32m+[m[32m iupAttribSetStr(glcanvas, "HWND", iupAttribGet(ih, "HWND"));[m +[32m+[m[32m #else[m +[32m+[m[32m iupAttribSetStr(glcanvas, "XWINDOW", iupAttribGet(ih, "XWINDOW"));[m +[32m+[m[32m #endif[m + #endif[m + glcanvas->iclass->Map(glcanvas);[m + }[m +[36m@@ -126,12 +134,15 @@[m [mstatic void gtkFileDlgPreviewRealize(GtkWidget *widget, Ihandle *ih)[m + iupAttribSetStr(ih, "PREVIEWDC", iupgtkGetNativeGraphicsContext(widget));[m + iupAttribSetStr(ih, "WID", (char*)widget);[m + [m +[31m-#ifdef WIN32 [m +[31m- iupAttribSetStr(ih, "HWND", (char*)GDK_WINDOW_HWND(widget->window));[m +[31m-#else[m +[31m- iupAttribSetStr(ih, "XWINDOW", (char*)GDK_WINDOW_XID(widget->window));[m +[31m- iupAttribSetStr(ih, "XDISPLAY", (char*)iupdrvGetDisplay());[m +[32m+[m[32m#ifndef GTK_MAC[m +[32m+[m[32m #ifdef WIN32[m[41m [m +[32m+[m[32m iupAttribSetStr(ih, "HWND", (char*)GDK_WINDOW_HWND(widget->window));[m +[32m+[m[32m #else[m +[32m+[m[32m iupAttribSetStr(ih, "XWINDOW", (char*)GDK_WINDOW_XID(widget->window));[m +[32m+[m[32m iupAttribSetStr(ih, "XDISPLAY", (char*)iupdrvGetDisplay());[m +[32m+[m[32m #endif[m + #endif[m +[32m+[m + gtkFileDlgUpdatePreviewGLCanvas(ih);[m + }[m + [m +[36m@@ -174,11 +185,11 @@[m [mstatic void gtkFileDlgUpdatePreview(GtkFileChooser *file_chooser, Ihandle* ih)[m + {[m + char *filename = gtk_file_chooser_get_preview_filename(file_chooser);[m + [m +[32m+[m[32m IFnss cb = (IFnss)IupGetCallback(ih, "FILE_CB");[m + if (iupdrvIsFile(filename))[m +[31m- {[m +[31m- IFnss cb = (IFnss)IupGetCallback(ih, "FILE_CB");[m + cb(ih, iupgtkStrConvertFromFilename(filename), "SELECT");[m +[31m- }[m +[32m+[m[32m else[m +[32m+[m[32m cb(ih, iupgtkStrConvertFromFilename(filename), "OTHER");[m + [m + g_free (filename);[m + [m +[36m@@ -469,6 +480,13 @@[m [mstatic int gtkFileDlgPopup(Ihandle* ih, int x, int y)[m + char* filename = (char*)file_list->data;[m + iupAttribStoreStr(ih, "VALUE", iupgtkStrConvertFromFilename(filename));[m + g_free(filename);[m +[32m+[m +[32m+[m[32m /* store the DIRECTORY */[m +[32m+[m[32m {[m +[32m+[m[32m char* dir = iupStrFileGetPath(iupAttribGet(ih, "VALUE"));[m +[32m+[m[32m iupAttribStoreStr(ih, "DIRECTORY", dir);[m +[32m+[m[32m free(dir);[m +[32m+[m[32m }[m + }[m + [m + g_slist_free(file_list);[m +[36m@@ -481,6 +499,14 @@[m [mstatic int gtkFileDlgPopup(Ihandle* ih, int x, int y)[m + iupAttribStoreStr(ih, "VALUE", iupgtkStrConvertFromFilename(filename));[m + file_exist = iupdrvIsFile(filename);[m + dir_exist = iupdrvIsDirectory(filename);[m +[32m+[m +[32m+[m[32m if (file_exist)[m +[32m+[m[32m {[m +[32m+[m[32m char* dir = iupStrFileGetPath(filename);[m +[32m+[m[32m iupAttribStoreStr(ih, "DIRECTORY", dir);[m +[32m+[m[32m free(dir);[m +[32m+[m[32m }[m +[32m+[m + g_free(filename);[m + }[m + [m +[36m@@ -507,8 +533,11 @@[m [mstatic int gtkFileDlgPopup(Ihandle* ih, int x, int y)[m + {[m + /* GtkFileChooser does not change the current directory */[m + char* dir = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog));[m +[31m- if (dir) iupdrvSetCurrentDirectory(dir);[m +[31m- g_free(dir);[m +[32m+[m[32m if (dir)[m[41m [m +[32m+[m[32m {[m +[32m+[m[32m iupdrvSetCurrentDirectory(dir);[m +[32m+[m[32m g_free(dir);[m +[32m+[m[32m }[m + }[m + }[m + else[m +[1mdiff --git a/iup/src/gtk/iupgtk_font.c b/iup/src/gtk/iupgtk_font.c[m +[1mindex f7ff348..1139f62 100755[m +[1m--- a/iup/src/gtk/iupgtk_font.c[m +[1m+++ b/iup/src/gtk/iupgtk_font.c[m +[36m@@ -132,9 +132,9 @@[m [mstatic IgtkFont* gtkFindFont(const char *standardfont)[m + [m + metrics = pango_context_get_metrics(gtk_fonts_context, fontdesc, pango_context_get_language(gtk_fonts_context));[m + fonts[i].charheight = pango_font_metrics_get_ascent(metrics) + pango_font_metrics_get_descent(metrics);[m +[31m- fonts[i].charheight = IUPGTK_PANGOUNITS2PIXELS(fonts[i].charheight);[m +[32m+[m[32m fonts[i].charheight = iupGTK_PANGOUNITS2PIXELS(fonts[i].charheight);[m + fonts[i].charwidth = pango_font_metrics_get_approximate_char_width(metrics);[m +[31m- fonts[i].charwidth = IUPGTK_PANGOUNITS2PIXELS(fonts[i].charwidth);[m +[32m+[m[32m fonts[i].charwidth = iupGTK_PANGOUNITS2PIXELS(fonts[i].charwidth);[m + pango_font_metrics_unref(metrics); [m + [m + gtkFontUpdate(&(fonts[i]));[m +[1mdiff --git a/iup/src/gtk/iupgtk_fontdlg.c b/iup/src/gtk/iupgtk_fontdlg.c[m +[1mindex 5769cbc..dca0232 100755[m +[1m--- a/iup/src/gtk/iupgtk_fontdlg.c[m +[1m+++ b/iup/src/gtk/iupgtk_fontdlg.c[m +[36m@@ -24,7 +24,7 @@[m [mstatic int gtkFontDlgPopup(Ihandle* ih, int x, int y)[m + InativeHandle* parent = iupDialogGetNativeParent(ih);[m + GtkFontSelectionDialog* dialog;[m + int response;[m +[31m- char* preview_text;[m +[32m+[m[32m char* preview_text, *standardfont;[m + [m + iupAttribSetInt(ih, "_IUPDLG_X", x); /* used in iupDialogUpdatePosition */[m + iupAttribSetInt(ih, "_IUPDLG_Y", y);[m +[36m@@ -36,7 +36,10 @@[m [mstatic int gtkFontDlgPopup(Ihandle* ih, int x, int y)[m + if (parent)[m + gtk_window_set_transient_for((GtkWindow*)dialog, (GtkWindow*)parent);[m + [m +[31m- gtk_font_selection_dialog_set_font_name(dialog, iupAttribGet(ih, "VALUE"));[m +[32m+[m[32m standardfont = iupAttribGet(ih, "VALUE");[m +[32m+[m[32m if (!standardfont)[m +[32m+[m[32m standardfont = IupGetGlobal("DEFAULTFONT");[m +[32m+[m[32m gtk_font_selection_dialog_set_font_name(dialog, standardfont);[m + [m + preview_text = iupAttribGet(ih, "PREVIEWTEXT");[m + if (preview_text)[m +[1mdiff --git a/iup/src/gtk/iupgtk_frame.c b/iup/src/gtk/iupgtk_frame.c[m +[1mindex 022c6c7..25595be 100755[m +[1m--- a/iup/src/gtk/iupgtk_frame.c[m +[1m+++ b/iup/src/gtk/iupgtk_frame.c[m +[36m@@ -41,8 +41,11 @@[m [mstatic char* gtkFrameGetTitleAttrib(Ihandle* ih)[m + [m + static int gtkFrameSetTitleAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- GtkFrame* frame = (GtkFrame*)ih->handle;[m +[31m- gtk_frame_set_label(frame, iupgtkStrConvertToUTF8(value));[m +[32m+[m[32m if (iupAttribGetStr(ih, "_IUPFRAME_HAS_TITLE"))[m +[32m+[m[32m {[m +[32m+[m[32m GtkFrame* frame = (GtkFrame*)ih->handle;[m +[32m+[m[32m gtk_frame_set_label(frame, iupgtkStrConvertToUTF8(value));[m +[32m+[m[32m }[m + return 0;[m + }[m + [m +[36m@@ -57,7 +60,11 @@[m [mstatic int gtkFrameSetBgColorAttrib(Ihandle* ih, const char* value)[m + if (label)[m + iupgtkBaseSetBgColor(label, r, g, b);[m + [m +[31m- iupgtkBaseSetBgColor(ih->handle, r, g, b);[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR"))[m +[32m+[m[32m {[m +[32m+[m[32m GtkWidget* fixed = gtk_bin_get_child((GtkBin*)ih->handle);[m +[32m+[m[32m iupgtkBaseSetBgColor(fixed, r, g, b);[m +[32m+[m[32m }[m + [m + return 1;[m + }[m +[36m@@ -120,10 +127,19 @@[m [mstatic int gtkFrameMapMethod(Ihandle* ih)[m + gtk_frame_set_shadow_type((GtkFrame*)ih->handle, GTK_SHADOW_IN);[m + else[m + gtk_frame_set_shadow_type((GtkFrame*)ih->handle, GTK_SHADOW_ETCHED_IN);[m +[32m+[m +[32m+[m[32m if (iupAttribGet(ih, "BGCOLOR"))[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPFRAME_HAS_BGCOLOR", "1");[m + }[m + [m + /* the container that will receive the child element. */[m + fixed = gtk_fixed_new();[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR"))[m +[32m+[m[32m#if GTK_CHECK_VERSION(2, 18, 0)[m +[32m+[m[32m gtk_widget_set_has_window(fixed, TRUE);[m +[32m+[m[32m#else[m +[32m+[m[32m gtk_fixed_set_has_window((GtkFixed*)fixed, TRUE);[m +[32m+[m[32m#endif[m + gtk_container_add((GtkContainer*)ih->handle, fixed);[m + gtk_widget_show(fixed);[m + [m +[1mdiff --git a/iup/src/gtk/iupgtk_key.c b/iup/src/gtk/iupgtk_key.c[m +[1mindex 5aec919..ed485a7 100755[m +[1m--- a/iup/src/gtk/iupgtk_key.c[m +[1m+++ b/iup/src/gtk/iupgtk_key.c[m +[36m@@ -316,9 +316,9 @@[m [mgboolean iupgtkKeyPressEvent(GtkWidget *widget, GdkEventKey *evt, Ihandle *ih)[m + if (code == 0) [m + return FALSE;[m + [m +[31m- /* Avoid duplicate calls if a child of the dialog contains the focus.[m +[31m- GTK will call the callback for the child and for the dialog */[m +[31m- if (ih->iclass->nativetype == IUP_TYPEDIALOG && ih != IupGetFocus())[m +[32m+[m[32m /* Avoid duplicate calls if a child of a native container contains the focus.[m +[32m+[m[32m GTK will call the callback for the child and for the container. */[m +[32m+[m[32m if (ih->iclass->childtype != IUP_CHILDNONE && ih != IupGetFocus())[m + return FALSE;[m + [m + result = iupKeyCallKeyCb(ih, code);[m +[36m@@ -390,33 +390,33 @@[m [mgboolean iupgtkKeyReleaseEvent(GtkWidget *widget, GdkEventKey *evt, Ihandle *ih)[m + void iupgtkButtonKeySetStatus(guint state, unsigned int but, char* status, int doubleclick)[m + {[m + if (state & GDK_SHIFT_MASK)[m +[31m- iupKEYSETSHIFT(status);[m +[32m+[m[32m iupKEY_SETSHIFT(status);[m + [m + if (state & GDK_CONTROL_MASK)[m +[31m- iupKEYSETCONTROL(status); [m +[32m+[m[32m iupKEY_SETCONTROL(status);[m[41m [m + [m + if ((state & GDK_BUTTON1_MASK) || but==1)[m +[31m- iupKEYSETBUTTON1(status);[m +[32m+[m[32m iupKEY_SETBUTTON1(status);[m + [m + if ((state & GDK_BUTTON2_MASK) || but==2)[m +[31m- iupKEYSETBUTTON2(status);[m +[32m+[m[32m iupKEY_SETBUTTON2(status);[m + [m + if ((state & GDK_BUTTON3_MASK) || but==3)[m +[31m- iupKEYSETBUTTON3(status);[m +[32m+[m[32m iupKEY_SETBUTTON3(status);[m + [m + if ((state & GDK_BUTTON4_MASK) || but==4)[m +[31m- iupKEYSETBUTTON4(status);[m +[32m+[m[32m iupKEY_SETBUTTON4(status);[m + [m + if ((state & GDK_BUTTON5_MASK) || but==5)[m +[31m- iupKEYSETBUTTON5(status);[m +[32m+[m[32m iupKEY_SETBUTTON5(status);[m + [m + if (state & GDK_MOD1_MASK || state & GDK_MOD5_MASK) /* Alt */[m +[31m- iupKEYSETALT(status);[m +[32m+[m[32m iupKEY_SETALT(status);[m + [m + if (state & GDK_MOD4_MASK) /* Apple/Win */[m +[31m- iupKEYSETSYS(status);[m +[32m+[m[32m iupKEY_SETSYS(status);[m + [m + if (doubleclick)[m +[31m- iupKEYSETDOUBLE(status);[m +[32m+[m[32m iupKEY_SETDOUBLE(status);[m + }[m + [m +[1mdiff --git a/iup/src/gtk/iupgtk_label.c b/iup/src/gtk/iupgtk_label.c[m +[1mindex 49d5c6d..f95f576 100755[m +[1m--- a/iup/src/gtk/iupgtk_label.c[m +[1m+++ b/iup/src/gtk/iupgtk_label.c[m +[36m@@ -133,8 +133,10 @@[m [mstatic int gtkLabelSetPaddingAttrib(Ihandle* ih, const char* value)[m + {[m + GtkMisc* misc = (GtkMisc*)ih->handle;[m + gtk_misc_set_padding(misc, ih->data->horiz_padding, ih->data->vert_padding);[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static char* gtkLabelGetPangoLayoutAttrib(Ihandle* ih)[m +[1mdiff --git a/iup/src/gtk/iupgtk_list.c b/iup/src/gtk/iupgtk_list.c[m +[1mindex 80f6cce..48fa88e 100755[m +[1m--- a/iup/src/gtk/iupgtk_list.c[m +[1m+++ b/iup/src/gtk/iupgtk_list.c[m +[36m@@ -113,6 +113,8 @@[m [mvoid iupdrvListInsertItem(Ihandle* ih, int pos, const char* value)[m + GtkTreeIter iter;[m + gtk_list_store_insert(GTK_LIST_STORE(model), &iter, pos);[m + gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, iupgtkStrConvertToUTF8(value), -1);[m +[32m+[m +[32m+[m[32m iupListUpdateOldValue(ih, pos, 0);[m + }[m + [m + void iupdrvListRemoveItem(Ihandle* ih, int pos)[m +[36m@@ -127,14 +129,24 @@[m [mvoid iupdrvListRemoveItem(Ihandle* ih, int pos)[m + int curpos = gtk_combo_box_get_active((GtkComboBox*)ih->handle);[m + if (pos == curpos)[m + {[m +[31m- if (curpos > 0) curpos--;[m +[31m- else curpos++;[m +[32m+[m[32m if (curpos > 0)[m[41m [m +[32m+[m[32m curpos--;[m +[32m+[m[32m else[m[41m [m +[32m+[m[32m {[m +[32m+[m[32m curpos=1;[m +[32m+[m[32m if (iupdrvListGetCount(ih)==1)[m +[32m+[m[32m curpos = -1; /* remove the selection */[m +[32m+[m[32m }[m + [m +[32m+[m[32m g_signal_handlers_block_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkListComboBoxChanged), ih);[m + gtk_combo_box_set_active((GtkComboBox*)ih->handle, curpos);[m +[32m+[m[32m g_signal_handlers_unblock_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkListComboBoxChanged), ih);[m + }[m + }[m + [m + gtk_list_store_remove(GTK_LIST_STORE(model), &iter);[m +[32m+[m +[32m+[m[32m iupListUpdateOldValue(ih, pos, 1);[m + }[m + }[m + [m +[36m@@ -177,7 +189,7 @@[m [mstatic int gtkListSetStandardFontAttrib(Ihandle* ih, const char* value)[m + static char* gtkListGetIdValueAttrib(Ihandle* ih, const char* name_id)[m + {[m + int pos = iupListGetPos(ih, name_id);[m +[31m- if (pos != -1)[m +[32m+[m[32m if (pos >= 0)[m + {[m + GtkTreeIter iter;[m + GtkTreeModel* model = gtkListGetModel(ih);[m +[36m@@ -349,7 +361,7 @@[m [mstatic int gtkListSetValueAttrib(Ihandle* ih, const char* value)[m + GtkTreeModel *model = gtkListGetModel(ih);[m + g_signal_handlers_block_by_func(G_OBJECT(ih->handle), G_CALLBACK(gtkListComboBoxChanged), ih);[m + if (iupStrToInt(value, &pos)==1 && [m +[31m- (pos>0 && pos<gtk_tree_model_iter_n_children(model, NULL)))[m +[32m+[m[32m (pos>0 && pos<=gtk_tree_model_iter_n_children(model, NULL)))[m + {[m + gtk_combo_box_set_active((GtkComboBox*)ih->handle, pos-1); /* IUP starts at 1 */[m + iupAttribSetInt(ih, "_IUPLIST_OLDVALUE", pos);[m +[36m@@ -788,9 +800,10 @@[m [mstatic int gtkListSetNCAttrib(Ihandle* ih, const char* value)[m + {[m + GtkEntry* entry = (GtkEntry*)iupAttribGet(ih, "_IUPGTK_ENTRY");[m + gtk_entry_set_max_length(entry, ih->data->nc);[m +[32m+[m[32m return 0;[m + }[m +[31m-[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int gtkListSetClipboardAttrib(Ihandle *ih, const char *value)[m +[36m@@ -1364,9 +1377,9 @@[m [mstatic int gtkListMapMethod(Ihandle* ih)[m + if (!ih->data->has_editbox && ih->data->is_multiple)[m + {[m + gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);[m +[31m-#if GTK_CHECK_VERSION(2, 10, 0)[m +[32m+[m[32m #if GTK_CHECK_VERSION(2, 10, 0)[m + gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(ih->handle), TRUE);[m +[31m-#endif[m +[32m+[m[32m #endif[m + }[m + else[m + gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);[m +[1mdiff --git a/iup/src/gtk/iupgtk_loop.c b/iup/src/gtk/iupgtk_loop.c[m +[1mindex e349a45..704923e 100755[m +[1m--- a/iup/src/gtk/iupgtk_loop.c[m +[1m+++ b/iup/src/gtk/iupgtk_loop.c[m +[36m@@ -69,6 +69,13 @@[m [mint IupMainLoop(void)[m + return IUP_NOERROR;[m + }[m + [m +[32m+[m[32mint IupLoopStepWait(void)[m +[32m+[m[32m{[m +[32m+[m[32m if (gtk_main_iteration_do(TRUE))[m +[32m+[m[32m return IUP_CLOSE;[m +[32m+[m[32m return IUP_DEFAULT;[m +[32m+[m[32m}[m +[32m+[m + int IupLoopStep(void)[m + {[m + if (gtk_main_iteration_do(FALSE))[m +[1mdiff --git a/iup/src/gtk/iupgtk_menu.c b/iup/src/gtk/iupgtk_menu.c[m +[1mindex c12fbea..772f4cf 100755[m +[1m--- a/iup/src/gtk/iupgtk_menu.c[m +[1m+++ b/iup/src/gtk/iupgtk_menu.c[m +[36m@@ -245,11 +245,19 @@[m [mstatic int gtkMenuMapMethod(Ihandle* ih)[m + return IUP_NOERROR;[m + }[m + [m +[32m+[m[32mstatic void gtkMenuUnMapMethod(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m if (iupMenuIsMenuBar(ih))[m +[32m+[m[32m ih->parent = NULL;[m +[32m+[m +[32m+[m[32m iupdrvBaseUnMapMethod(ih);[m +[32m+[m[32m}[m +[32m+[m + void iupdrvMenuInitClass(Iclass* ic)[m + {[m + /* Driver Dependent Class functions */[m + ic->Map = gtkMenuMapMethod;[m +[31m- ic->UnMap = iupdrvBaseUnMapMethod;[m +[32m+[m[32m ic->UnMap = gtkMenuUnMapMethod;[m + [m + /* Used by iupdrvMenuGetMenuBarSize */[m + iupClassRegisterAttribute(ic, "STANDARDFONT", NULL, NULL, IUPAF_SAMEASSYSTEM, "DEFAULTFONT", IUPAF_DEFAULT); /* use inheritance to retrieve standard fonts */[m +[36m@@ -337,15 +345,10 @@[m [mstatic int gtkItemSetValueAttrib(Ihandle* ih, const char* value)[m + [m + static char* gtkItemGetValueAttrib(Ihandle* ih)[m + {[m +[31m- if (GTK_IS_CHECK_MENU_ITEM(ih->handle))[m +[31m- {[m +[31m- if (gtk_check_menu_item_get_active((GtkCheckMenuItem*)ih->handle))[m +[31m- return "ON";[m +[31m- else[m +[31m- return "OFF";[m +[31m- }[m +[32m+[m[32m if (GTK_IS_CHECK_MENU_ITEM(ih->handle) && gtk_check_menu_item_get_active((GtkCheckMenuItem*)ih->handle))[m +[32m+[m[32m return "ON";[m + else[m +[31m- return NULL;[m +[32m+[m[32m return "OFF";[m + }[m + [m + static int gtkItemMapMethod(Ihandle* ih)[m +[1mdiff --git a/iup/src/gtk/iupgtk_open.c b/iup/src/gtk/iupgtk_open.c[m +[1mindex 66e46e8..962f760 100755[m +[1m--- a/iup/src/gtk/iupgtk_open.c[m +[1m+++ b/iup/src/gtk/iupgtk_open.c[m +[36m@@ -20,7 +20,52 @@[m + [m + #include "iupgtk_drv.h"[m + [m +[32m+[m[32m#ifdef GTK_MAC[m +[32m+[m[32m#include <gdk/gdk.h>[m + [m +[32m+[m[32mchar* iupgtkGetNativeWindowHandle(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m GdkWindow* window = ih->handle->window;[m +[32m+[m[32m if (window)[m +[32m+[m[32m return (char*)window;[m +[32m+[m[32m else[m +[32m+[m[32m return NULL;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid* iupgtkGetNativeGraphicsContext(GtkWidget* widget)[m +[32m+[m[32m{[m +[32m+[m[32m return (void*)gdk_gc_new((GdkDrawable*)widget->window);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupgtkReleaseNativeGraphicsContext(GtkWidget* widget, void* gc)[m +[32m+[m[32m{[m +[32m+[m[32m g_object_unref(gc);[m +[32m+[m[32m (void)widget;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid* iupdrvGetDisplay(void)[m +[32m+[m[32m{[m +[32m+[m[32m GdkDisplay* display = gdk_display_get_default();[m +[32m+[m[32m return display;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupgtkPushVisualAndColormap(void* visual, void* colormap)[m +[32m+[m[32m{[m +[32m+[m[32m GdkColormap* gdk_colormap;[m +[32m+[m[32m GdkVisual *gdk_visual = gdk_visual_get_best();[m +[32m+[m +[32m+[m[32m gdk_colormap = gdk_colormap_new(gdk_visual, FALSE);[m +[32m+[m +[32m+[m[32m gtk_widget_push_colormap(gdk_colormap);[m +[32m+[m +[32m+[m[32m /* gtk_widget_push_visual is now deprecated */[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void gtkSetDrvGlobalAttrib(void)[m +[32m+[m[32m{[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32m#else[m + #ifdef WIN32 /******************************** WIN32 ************************************/[m + #include <gdk/gdkwin32.h>[m + [m +[36m@@ -115,6 +160,8 @@[m [mstatic void gtkSetDrvGlobalAttrib(void)[m + [m + #endif[m + [m +[32m+[m[32m#endif[m +[32m+[m + static void gtkSetGlobalColorAttrib(const char* name, GdkColor *color)[m + {[m + iupGlobalSetDefaultColorAttrib(name, (int)iupCOLOR16TO8(color->red), [m +[1mdiff --git a/iup/src/gtk/iupgtk_tabs.c b/iup/src/gtk/iupgtk_tabs.c[m +[1mindex 8029826..6b5aa66 100755[m +[1m--- a/iup/src/gtk/iupgtk_tabs.c[m +[1m+++ b/iup/src/gtk/iupgtk_tabs.c[m +[36m@@ -76,13 +76,13 @@[m [mstatic void gtkTabsUpdatePageBgColor(Ihandle* ih, unsigned char r, unsigned char[m + [m + for (child = ih->firstchild; child; child = child->brother)[m + {[m +[31m- GtkWidget* tab_page = (GtkWidget*)iupAttribGet(child, "_IUPTAB_CONTAINER");[m +[31m- if (tab_page)[m +[32m+[m[32m GtkWidget* tab_container = (GtkWidget*)iupAttribGet(child, "_IUPTAB_CONTAINER");[m +[32m+[m[32m if (tab_container)[m + {[m + GtkWidget* tab_label = (GtkWidget*)iupAttribGet(child, "_IUPGTK_TABLABEL");[m + if (tab_label)[m + iupgtkBaseSetBgColor(tab_label, r, g, b);[m +[31m- iupgtkBaseSetBgColor(tab_page, r, g, b);[m +[32m+[m[32m iupgtkBaseSetBgColor(tab_container, r, g, b);[m + }[m + }[m + }[m +[36m@@ -121,15 +121,18 @@[m [mstatic int gtkTabsSetPaddingAttrib(Ihandle* ih, const char* value)[m + iupStrToIntInt(value, &ih->data->horiz_padding, &ih->data->vert_padding, 'x');[m + [m + if (ih->handle)[m +[32m+[m[32m {[m + gtkTabsUpdatePagePadding(ih);[m +[31m- return 0;[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static void gtkTabsUpdateTabType(Ihandle* ih)[m + {[m +[31m- GtkNotebook* tab_page = (GtkNotebook*)ih->handle;[m + int iup2gtk[4] = {GTK_POS_TOP, GTK_POS_BOTTOM, GTK_POS_LEFT, GTK_POS_RIGHT};[m +[31m- gtk_notebook_set_tab_pos(tab_page, iup2gtk[ih->data->type]);[m +[32m+[m[32m gtk_notebook_set_tab_pos((GtkNotebook*)ih->handle, iup2gtk[ih->data->type]);[m + }[m + [m + static int gtkTabsSetTabTypeAttrib(Ihandle* ih, const char* value)[m +[36m@@ -144,7 +147,7 @@[m [mstatic int gtkTabsSetTabTypeAttrib(Ihandle* ih, const char* value)[m + ih->data->type = ITABS_TOP;[m + [m + if (ih->handle)[m +[31m- gtkTabsUpdateTabType(ih);[m +[32m+[m[32m gtkTabsUpdateTabType(ih); /* for this to work must be updated in map */[m + [m + return 0;[m + }[m +[36m@@ -171,7 +174,7 @@[m [mstatic int gtkTabsSetTabTitleAttrib(Ihandle* ih, const char* name_id, const char[m + GtkWidget* tab_label = (GtkWidget*)iupAttribGet(child, "_IUPGTK_TABLABEL");[m + if (tab_label)[m + {[m +[31m- GtkWidget* tab_page = (GtkWidget*)iupAttribGet(child, "_IUPTAB_CONTAINER");[m +[32m+[m[32m GtkWidget* tab_page = (GtkWidget*)iupAttribGet(child, "_IUPTAB_PAGE");[m + gtk_label_set_text((GtkLabel*)tab_label, iupgtkStrConvertToUTF8(value));[m + gtk_notebook_set_menu_label_text((GtkNotebook*)ih->handle, tab_page, gtk_label_get_text((GtkLabel*)tab_label));[m + }[m +[36m@@ -238,8 +241,10 @@[m [mvoid gtkTabSwitchPage(GtkNotebook* notebook, GtkNotebookPage *page, int pos, Iha[m + IFnnn cb;[m + Ihandle* child = IupGetChild(ih, pos);[m + Ihandle* prev_child = IupGetChild(ih, iupdrvTabsGetCurrentTab(ih));[m +[31m- IupSetAttribute(child, "VISIBLE", "YES");[m +[31m- IupSetAttribute(prev_child, "VISIBLE", "NO");[m +[32m+[m[32m GtkWidget* tab_container = (GtkWidget*)iupAttribGet(child, "_IUPTAB_CONTAINER");[m +[32m+[m[32m GtkWidget* prev_tab_container = (GtkWidget*)iupAttribGet(prev_child, "_IUPTAB_CONTAINER");[m +[32m+[m[32m if (tab_container) gtk_widget_show(tab_container);[m +[32m+[m[32m if (prev_tab_container) gtk_widget_hide(prev_tab_container);[m + [m + if (iupAttribGet(ih, "_IUPGTK_IGNORE_CHANGE"))[m + return;[m +[36m@@ -263,7 +268,7 @@[m [mstatic void gtkTabsChildAddedMethod(Ihandle* ih, Ihandle* child)[m + [m + if (ih->handle)[m + {[m +[31m- GtkWidget* tab_page;[m +[32m+[m[32m GtkWidget *tab_page, *tab_container;[m + GtkWidget *tab_label = NULL, *tab_image = NULL;[m + char *tabtitle, *tabimage;[m + int pos;[m +[36m@@ -271,9 +276,13 @@[m [mstatic void gtkTabsChildAddedMethod(Ihandle* ih, Ihandle* child)[m + [m + pos = IupGetChildPos(ih, child);[m + [m +[31m- tab_page = gtk_fixed_new();[m +[32m+[m[32m tab_page = gtk_vbox_new(FALSE, 0);[m + gtk_widget_show(tab_page);[m + [m +[32m+[m[32m tab_container = gtk_fixed_new();[m +[32m+[m[32m gtk_widget_show(tab_container);[m +[32m+[m[32m gtk_container_add((GtkContainer*)tab_page, tab_container);[m +[32m+[m + tabtitle = iupAttribGet(child, "TABTITLE");[m + if (!tabtitle) tabtitle = iupTabsAttribGetStrId(ih, "TABTITLE", pos);[m + tabimage = iupAttribGet(child, "TABIMAGE");[m +[36m@@ -327,9 +336,10 @@[m [mstatic void gtkTabsChildAddedMethod(Ihandle* ih, Ihandle* child)[m + [m + iupAttribSetStr(child, "_IUPGTK_TABIMAGE", (char*)tab_image); /* store it even if its NULL */[m + iupAttribSetStr(child, "_IUPGTK_TABLABEL", (char*)tab_label);[m +[31m- iupAttribSetStr(child, "_IUPTAB_CONTAINER", (char*)tab_page);[m +[32m+[m[32m iupAttribSetStr(child, "_IUPTAB_CONTAINER", (char*)tab_container);[m +[32m+[m[32m iupAttribSetStr(child, "_IUPTAB_PAGE", (char*)tab_page);[m + iupStrToRGB(IupGetAttribute(ih, "BGCOLOR"), &r, &g, &b);[m +[31m- iupgtkBaseSetBgColor(tab_page, r, g, b);[m +[32m+[m[32m iupgtkBaseSetBgColor(tab_container, r, g, b);[m + [m + if (tabtitle)[m + {[m +[36m@@ -354,10 +364,8 @@[m [mstatic void gtkTabsChildAddedMethod(Ihandle* ih, Ihandle* child)[m + [m + iupAttribSetStr(ih, "_IUPGTK_IGNORE_CHANGE", NULL);[m + [m +[31m- if (pos == iupdrvTabsGetCurrentTab(ih))[m +[31m- IupSetAttribute(child, "VISIBLE", "YES");[m +[31m- else[m +[31m- IupSetAttribute(child, "VISIBLE", "NO");[m +[32m+[m[32m if (pos != iupdrvTabsGetCurrentTab(ih))[m +[32m+[m[32m gtk_widget_hide(tab_container);[m + }[m + }[m + [m +[36m@@ -365,10 +373,11 @@[m [mstatic void gtkTabsChildRemovedMethod(Ihandle* ih, Ihandle* child)[m + {[m + if (ih->handle)[m + {[m +[31m- GtkWidget* tab_page = (GtkWidget*)iupAttribGet(child, "_IUPTAB_CONTAINER");[m +[32m+[m[32m GtkWidget* tab_page = (GtkWidget*)iupAttribGet(child, "_IUPTAB_PAGE");[m + if (tab_page)[m + {[m + int pos = gtk_notebook_page_num((GtkNotebook*)ih->handle, tab_page);[m +[32m+[m[32m iupTabsTestRemoveTab(ih, pos);[m + [m + iupAttribSetStr(ih, "_IUPGTK_IGNORE_CHANGE", "1");[m + gtk_notebook_remove_page((GtkNotebook*)ih->handle, pos);[m +[36m@@ -377,6 +386,7 @@[m [mstatic void gtkTabsChildRemovedMethod(Ihandle* ih, Ihandle* child)[m + iupAttribSetStr(child, "_IUPGTK_TABIMAGE", NULL);[m + iupAttribSetStr(child, "_IUPGTK_TABLABEL", NULL);[m + iupAttribSetStr(child, "_IUPTAB_CONTAINER", NULL);[m +[32m+[m[32m iupAttribSetStr(child, "_IUPTAB_PAGE", NULL);[m + }[m + }[m + }[m +[36m@@ -440,5 +450,5 @@[m [mvoid iupdrvTabsInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "TABORIENTATION", iupTabsGetTabOrientationAttrib, gtkTabsSetTabOrientationAttrib, IUPAF_SAMEASSYSTEM, "HORIZONTAL", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TABTITLE", NULL, gtkTabsSetTabTitleAttrib, IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TABIMAGE", NULL, gtkTabsSetTabImageAttrib, IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttribute(ic, "PADDING", iupTabsGetPaddingAttrib, gtkTabsSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "PADDING", iupTabsGetPaddingAttrib, gtkTabsSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + }[m +[1mdiff --git a/iup/src/gtk/iupgtk_text.c b/iup/src/gtk/iupgtk_text.c[m +[1mindex 4c2906a..d0909d7 100755[m +[1m--- a/iup/src/gtk/iupgtk_text.c[m +[1m+++ b/iup/src/gtk/iupgtk_text.c[m +[36m@@ -101,7 +101,7 @@[m [mstatic void gtkTextParseParagraphFormat(Ihandle* formattag, GtkTextTag* tag)[m + align = PANGO_TAB_LEFT;[m + free(str);[m + [m +[31m- pango_tab_array_set_tab(tabs, i, align, IUPGTK_PIXELS2PANGOUNITS(pos));[m +[32m+[m[32m pango_tab_array_set_tab(tabs, i, align, iupGTK_PIXELS2PANGOUNITS(pos));[m + i++;[m + if (i == 32) break;[m + }[m +[36m@@ -171,7 +171,7 @@[m [mstatic void gtkTextParseCharacterFormat(Ihandle* formattag, GtkTextTag* tag)[m + else [m + iupStrToInt(format, &val);[m + [m +[31m- val = IUPGTK_PIXELS2PANGOUNITS(val);[m +[32m+[m[32m val = iupGTK_PIXELS2PANGOUNITS(val);[m + g_object_set(G_OBJECT(tag), "rise", val, NULL);[m + }[m + [m +[36m@@ -214,7 +214,7 @@[m [mstatic void gtkTextParseCharacterFormat(Ihandle* formattag, GtkTextTag* tag)[m + {[m + if (val < 0) /* in pixels */[m + {[m +[31m- val = IUPGTK_PIXELS2PANGOUNITS(-val);[m +[32m+[m[32m val = iupGTK_PIXELS2PANGOUNITS(-val);[m + g_object_set(G_OBJECT(tag), "size", val, NULL);[m + }[m + else /* in points */[m +[36m@@ -387,8 +387,8 @@[m [mstatic int gtkTextConvertXYToPos(Ihandle* ih, int x, int y)[m + [m + /* transform to Layout coordinates */[m + gtk_entry_get_layout_offsets(GTK_ENTRY(ih->handle), &off_x, &off_y);[m +[31m- x = IUPGTK_PIXELS2PANGOUNITS(x - off_x); [m +[31m- y = IUPGTK_PIXELS2PANGOUNITS(y - off_y);[m +[32m+[m[32m x = iupGTK_PIXELS2PANGOUNITS(x - off_x);[m[41m [m +[32m+[m[32m y = iupGTK_PIXELS2PANGOUNITS(y - off_y);[m + [m + pango_layout_xy_to_index(gtk_entry_get_layout(GTK_ENTRY(ih->handle)), x, y, &pos, &trailing);[m + return pos;[m +[36m@@ -851,7 +851,7 @@[m [mstatic char* gtkTextGetValueAttrib(Ihandle* ih)[m + [m + static int gtkTextSetInsertAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + if (!value)[m + return 0;[m +[36m@@ -875,7 +875,8 @@[m [mstatic int gtkTextSetInsertAttrib(Ihandle* ih, const char* value)[m + [m + static int gtkTextSetAppendAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m gint pos;[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + /* disable callbacks */[m + iupAttribSetStr(ih, "_IUPGTK_DISABLE_TEXT_CB", "1");[m +[36m@@ -884,13 +885,18 @@[m [mstatic int gtkTextSetAppendAttrib(Ihandle* ih, const char* value)[m + GtkTextIter iter;[m + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ih->handle));[m + gtk_text_buffer_get_end_iter(buffer, &iter);[m +[31m- if (ih->data->append_newline)[m +[32m+[m[32m pos = gtk_text_buffer_get_char_count(buffer);[m +[32m+[m[32m if (ih->data->append_newline && pos!=0)[m + gtk_text_buffer_insert(buffer, &iter, "\n", 1);[m + gtk_text_buffer_insert(buffer, &iter, iupgtkStrConvertToUTF8(value), -1);[m + }[m + else[m + {[m +[31m- gint pos = strlen(gtk_entry_get_text(GTK_ENTRY(ih->handle)))+1;[m +[32m+[m[32m#if GTK_CHECK_VERSION(2, 14, 0)[m +[32m+[m[32m pos = gtk_entry_get_text_length(GTK_ENTRY(ih->handle))+1;[m +[32m+[m[32m#else[m +[32m+[m[32m pos = strlen(gtk_entry_get_text(GTK_ENTRY(ih->handle)))+1;[m +[32m+[m[32m#endif[m + gtk_editable_insert_text(GTK_EDITABLE(ih->handle), iupgtkStrConvertToUTF8(value), -1, &pos);[m + }[m + iupAttribSetStr(ih, "_IUPGTK_DISABLE_TEXT_CB", NULL);[m +[36m@@ -946,8 +952,10 @@[m [mstatic int gtkTextSetPaddingAttrib(Ihandle* ih, const char* value)[m + gtk_entry_set_inner_border(GTK_ENTRY(ih->handle), &border);[m + #endif[m + }[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int gtkTextSetNCAttrib(Ihandle* ih, const char* value)[m +[36m@@ -955,10 +963,14 @@[m [mstatic int gtkTextSetNCAttrib(Ihandle* ih, const char* value)[m + if (!iupStrToInt(value, &ih->data->nc))[m + ih->data->nc = INT_MAX;[m + [m +[31m- if (!ih->data->is_multiline && ih->handle)[m +[31m- gtk_entry_set_max_length(GTK_ENTRY(ih->handle), ih->data->nc);[m +[31m-[m +[31m- return 0;[m +[32m+[m[32m if (ih->handle)[m +[32m+[m[32m {[m +[32m+[m[32m if (!ih->data->is_multiline)[m +[32m+[m[32m gtk_entry_set_max_length(GTK_ENTRY(ih->handle), ih->data->nc);[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int gtkTextSetClipboardAttrib(Ihandle *ih, const char *value)[m +[1mdiff --git a/iup/src/gtk/iupgtk_toggle.c b/iup/src/gtk/iupgtk_toggle.c[m +[1mindex 8ff7df5..040beda 100755[m +[1m--- a/iup/src/gtk/iupgtk_toggle.c[m +[1m+++ b/iup/src/gtk/iupgtk_toggle.c[m +[36m@@ -213,8 +213,10 @@[m [mstatic int gtkToggleSetPaddingAttrib(Ihandle* ih, const char* value)[m + GtkButton* button = (GtkButton*)ih->handle;[m + GtkMisc* misc = (GtkMisc*)gtk_button_get_image(button);[m + gtk_misc_set_padding(misc, ih->data->horiz_padding, ih->data->vert_padding);[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int gtkToggleSetFgColorAttrib(Ihandle* ih, const char* value)[m +[1mdiff --git a/iup/src/gtk/iupgtk_tree.c b/iup/src/gtk/iupgtk_tree.c[m +[1mindex d408f27..9595ada 100755[m +[1m--- a/iup/src/gtk/iupgtk_tree.c[m +[1m+++ b/iup/src/gtk/iupgtk_tree.c[m +[36m@@ -31,33 +31,50 @@[m + #include "iup_drvinfo.h"[m + #include "iupgtk_drv.h"[m + [m +[32m+[m +[32m+[m[32m/* IMPORTANT:[m[41m [m +[32m+[m +[32m+[m[32m GtkTreeStore uses the "user_data" field of the GtkTreeIter[m[41m [m +[32m+[m[32m to store the node pointer that is position independent.[m +[32m+[m[32m So we use it as a reference to the node in the cache, just like in Motif and Windows.[m +[32m+[m +[32m+[m[32m BUT if GTK change its implementation this must be changed also. See "gtk_tree_store.c".[m +[32m+[m +[32m+[m[32m ABOUT SELECTIONS:[m +[32m+[m +[32m+[m[32m From the GTK documentation on GtkTreeSelection[m +[32m+[m +[32m+[m[32m "Additionally, you cannot change the selection of a row on the model[m[41m [m +[32m+[m[32m that is not currently displayed by the view without expanding its parents first."[m +[32m+[m[32m*/[m +[32m+[m + enum[m + {[m +[31m- IUPGTK_TREE_IMAGE,[m +[32m+[m[32m IUPGTK_TREE_IMAGE, /* "pixbuf", "pixbuf-expander-closed" */[m + IUPGTK_TREE_HAS_IMAGE,[m +[31m- IUPGTK_TREE_IMAGE_EXPANDED,[m +[32m+[m[32m IUPGTK_TREE_IMAGE_EXPANDED, /* "pixbuf-expander-open" */[m + IUPGTK_TREE_HAS_IMAGE_EXPANDED,[m +[31m- IUPGTK_TREE_TITLE,[m +[31m- IUPGTK_TREE_KIND,[m +[31m- IUPGTK_TREE_COLOR,[m +[31m- IUPGTK_TREE_FONT,[m +[31m- IUPGTK_TREE_USERDATA[m +[32m+[m[32m IUPGTK_TREE_TITLE, /* "text" */[m +[32m+[m[32m IUPGTK_TREE_KIND, /* "is-expander" */[m +[32m+[m[32m IUPGTK_TREE_COLOR, /* "foreground-gdk" */[m +[32m+[m[32m IUPGTK_TREE_FONT, /* "font-desc" */[m +[32m+[m[32m IUPGTK_TREE_SELECT,[m +[32m+[m[32m IUPGTK_TREE_LAST_DATA /* used as a count */[m + };[m + [m +[31m-static GtkTreeIter gtkTreeInvalidIter = {0,0,0,0};[m +[32m+[m[32mstatic void gtkTreeRebuildNodeCache(Ihandle* ih, int id, GtkTreeIter iterItem);[m + [m + /*****************************************************************************/[m + /* COPYING ITEMS (Branches and its children) */[m + /*****************************************************************************/[m + /* Insert the copied item in a new location. Returns the new item. */[m +[31m-static void gtkTreeCopyItem(GtkTreeModel* model, GtkTreeIter* iterItem, GtkTreeIter* iterParent, int position, GtkTreeIter *iterNewItem, int full_copy)[m +[32m+[m[32mstatic void gtkTreeCopyItem(Ihandle* ih, GtkTreeModel* model, GtkTreeIter* iterItem, GtkTreeIter* iterParent, int position, GtkTreeIter *iterNewItem)[m + {[m + GtkTreeStore* store = GTK_TREE_STORE(model);[m + int kind;[m + char* title;[m + gboolean has_image, has_image_expanded;[m + PangoFontDescription* font;[m +[31m- void* userdata;[m + GdkColor *color;[m + GdkPixbuf* image, *image_expanded;[m + [m +[36m@@ -69,9 +86,10 @@[m [mstatic void gtkTreeCopyItem(GtkTreeModel* model, GtkTreeIter* iterItem, GtkTreeI[m + IUPGTK_TREE_KIND, &kind,[m + IUPGTK_TREE_COLOR, &color, [m + IUPGTK_TREE_FONT, &font, [m +[31m- IUPGTK_TREE_USERDATA, &userdata,[m + -1);[m + [m +[32m+[m[32m /* Add the new node */[m +[32m+[m[32m ih->data->node_count++;[m + if (position == 2)[m + gtk_tree_store_append(store, iterNewItem, iterParent);[m + else if (position == 1) /* copy as first child of expanded branch */[m +[36m@@ -79,9 +97,6 @@[m [mstatic void gtkTreeCopyItem(GtkTreeModel* model, GtkTreeIter* iterItem, GtkTreeI[m + else /* copy as next brother of item or collapsed branch */[m + gtk_tree_store_insert_after(store, iterNewItem, NULL, iterParent); /* iterParent is sibling of the new item */[m + [m +[31m- if (full_copy) /* during a full copy the userdata reference is not copied */[m +[31m- userdata = NULL;[m +[31m-[m + gtk_tree_store_set(store, iterNewItem, IUPGTK_TREE_IMAGE, image,[m + IUPGTK_TREE_HAS_IMAGE, has_image,[m + IUPGTK_TREE_IMAGE_EXPANDED, image_expanded,[m +[36m@@ -90,21 +105,21 @@[m [mstatic void gtkTreeCopyItem(GtkTreeModel* model, GtkTreeIter* iterItem, GtkTreeI[m + IUPGTK_TREE_KIND, kind,[m + IUPGTK_TREE_COLOR, color, [m + IUPGTK_TREE_FONT, font,[m +[31m- IUPGTK_TREE_USERDATA, userdata,[m +[32m+[m[32m IUPGTK_TREE_SELECT, 0,[m + -1);[m + }[m + [m +[31m-static void gtkTreeCopyChildren(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItemSrc, GtkTreeIter *iterItemDst, int full_copy)[m +[32m+[m[32mstatic void gtkTreeCopyChildren(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItemSrc, GtkTreeIter *iterItemDst)[m + {[m + GtkTreeIter iterChildSrc;[m + int hasItem = gtk_tree_model_iter_children(model, &iterChildSrc, iterItemSrc); /* get the firstchild */[m + while(hasItem)[m + {[m + GtkTreeIter iterNewItem;[m +[31m- gtkTreeCopyItem(model, &iterChildSrc, iterItemDst, 2, &iterNewItem, full_copy); /* append always */[m +[32m+[m[32m gtkTreeCopyItem(ih, model, &iterChildSrc, iterItemDst, 2, &iterNewItem); /* append always */[m + [m + /* Recursively transfer all the items */[m +[31m- gtkTreeCopyChildren(ih, model, &iterChildSrc, &iterNewItem, full_copy); [m +[32m+[m[32m gtkTreeCopyChildren(ih, model, &iterChildSrc, &iterNewItem);[m[41m [m + [m + /* Go to next sibling item */[m + hasItem = gtk_tree_model_iter_next(model, &iterChildSrc);[m +[36m@@ -112,9 +127,17 @@[m [mstatic void gtkTreeCopyChildren(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *i[m + }[m + [m + /* Copies all items in a branch to a new location. Returns the new branch node. */[m +[31m-static void gtkTreeCopyNode(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItemSrc, GtkTreeIter *iterItemDst, GtkTreeIter* iterNewItem, int full_copy)[m +[32m+[m[32mstatic void gtkTreeCopyMoveNode(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItemSrc, GtkTreeIter *iterItemDst, GtkTreeIter* iterNewItem, int is_copy)[m + {[m + int kind, position = 0; /* insert after iterItemDst */[m +[32m+[m[32m int id_new, count, id_src, id_dst;[m +[32m+[m +[32m+[m[32m int old_count = ih->data->node_count;[m +[32m+[m +[32m+[m[32m id_src = iupTreeFindNodeId(ih, iterItemSrc);[m +[32m+[m[32m id_dst = iupTreeFindNodeId(ih, iterItemDst);[m +[32m+[m[32m id_new = id_dst+1; /* contains the position for a copy operation */[m +[32m+[m + gtk_tree_model_get(model, iterItemDst, IUPGTK_TREE_KIND, &kind, -1);[m + [m + if (kind == ITREE_BRANCH)[m +[36m@@ -122,346 +145,311 @@[m [mstatic void gtkTreeCopyNode(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterI[m + GtkTreePath* path = gtk_tree_model_get_path(model, iterItemDst);[m + if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(ih->handle), path))[m + position = 1; /* insert as first child of iterItemDst */[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m int child_count = iupdrvTreeTotalChildCount(ih, iterItemDst);[m +[32m+[m[32m id_new += child_count;[m +[32m+[m[32m }[m + gtk_tree_path_free(path);[m + }[m + [m +[31m- gtkTreeCopyItem(model, iterItemSrc, iterItemDst, position, iterNewItem, full_copy); [m +[32m+[m[32m /* move to the same place does nothing */[m +[32m+[m[32m if (!is_copy && id_new == id_src)[m +[32m+[m[32m {[m +[32m+[m[32m iterNewItem->stamp = 0;[m +[32m+[m[32m return;[m +[32m+[m[32m }[m + [m +[31m- gtkTreeCopyChildren(ih, model, iterItemSrc, iterNewItem, full_copy);[m +[31m-}[m +[32m+[m[32m gtkTreeCopyItem(ih, model, iterItemSrc, iterItemDst, position, iterNewItem);[m[41m [m + [m +[31m-/*****************************************************************************/[m +[31m-/* FINDING ITEMS */[m +[31m-/*****************************************************************************/[m +[32m+[m[32m gtkTreeCopyChildren(ih, model, iterItemSrc, iterNewItem);[m + [m +[31m-static void gtkTreeInvertAllNodeMarking(Ihandle* ih, GtkTreeModel* model, GtkTreeSelection* selection, GtkTreeIter* iterItem)[m +[31m-{[m +[31m- GtkTreeIter iterChild;[m +[31m- int hasItem = TRUE;[m +[32m+[m[32m count = ih->data->node_count - old_count;[m +[32m+[m[32m iupTreeCopyMoveCache(ih, id_src, id_new, count, is_copy);[m + [m +[31m- while(hasItem)[m +[32m+[m[32m if (!is_copy)[m + {[m +[31m- if(gtk_tree_selection_iter_is_selected(selection, iterItem))[m +[31m- gtk_tree_selection_unselect_iter(selection, iterItem);[m +[31m- else[m +[31m- gtk_tree_selection_select_iter(selection, iterItem);[m +[32m+[m[32m /* Deleting the node of its old position */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m[32m gtk_tree_store_remove(GTK_TREE_STORE(model), iterItemSrc);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + [m +[31m- /* Check whether we have child items */[m +[31m- if(gtk_tree_model_iter_has_child(model, iterItem))[m +[31m- {[m +[31m- gtk_tree_model_iter_children(model, &iterChild, iterItem); /* get the firstchild */[m +[31m- gtkTreeInvertAllNodeMarking(ih, model, selection, &iterChild);[m +[31m- }[m +[32m+[m[32m /* restore count, because we remove src */[m +[32m+[m[32m ih->data->node_count = old_count;[m + [m +[31m- /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, iterItem);[m +[32m+[m[32m /* compensate position for a move */[m +[32m+[m[32m if (id_new > id_src)[m +[32m+[m[32m id_new -= count;[m + }[m +[32m+[m +[32m+[m[32m gtkTreeRebuildNodeCache(ih, id_new, *iterNewItem);[m + }[m + [m +[31m-static GtkTreeIter gtkTreeFindVisibleNodeId(Ihandle* ih, GtkTreeModel* model, GtkTreeIter iterItem, GtkTreeIter iterNode)[m +[32m+[m[32m/*****************************************************************************/[m +[32m+[m[32m/* FINDING ITEMS */[m +[32m+[m[32m/*****************************************************************************/[m +[32m+[m +[32m+[m[32mstatic void gtkTreeIterInit(Ihandle* ih, GtkTreeIter* iterItem, InodeHandle* node_handle)[m + {[m +[31m- GtkTreeIter iterChild;[m +[31m- GtkTreePath* path;[m +[31m- int hasItem = TRUE;[m +[32m+[m[32m iterItem->stamp = ih->data->stamp;[m +[32m+[m[32m iterItem->user_data = node_handle;[m +[32m+[m[32m iterItem->user_data2 = NULL;[m +[32m+[m[32m iterItem->user_data3 = NULL;[m +[32m+[m[32m}[m + [m +[31m- while(hasItem)[m +[31m- {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control++; /* not the real id since it counts only the visible ones */[m +[32m+[m[32mstatic int gtkTreeIsNodeSelected(GtkTreeModel* model, GtkTreeIter *iterItem)[m +[32m+[m[32m{[m +[32m+[m[32m gboolean selected = 0;[m +[32m+[m[32m gtk_tree_model_get(model, iterItem, IUPGTK_TREE_SELECT, &selected, -1);[m +[32m+[m[32m return selected;[m +[32m+[m[32m}[m + [m +[31m- /* StateID founded! */[m +[31m- if(iterItem.user_data == iterNode.user_data)[m +[31m- return iterItem;[m +[32m+[m[32mstatic void gtkTreeSelectNodeRaw(GtkTreeModel* model, GtkTreeIter *iterItem, int select)[m +[32m+[m[32m{[m +[32m+[m[32m /* Cannot change the selection of a row on the model that is not currently displayed.[m[41m [m +[32m+[m[32m So we store the selection state here. And update the actual state when the node becames visible. */[m +[32m+[m[32m gtk_tree_store_set(GTK_TREE_STORE(model), iterItem, IUPGTK_TREE_SELECT, select, -1);[m +[32m+[m[32m}[m + [m +[31m- path = gtk_tree_model_get_path(model, &iterItem);[m +[32m+[m[32mstatic void gtkTreeSelectNode(GtkTreeModel* model, GtkTreeSelection* selection, GtkTreeIter *iterItem, int select)[m +[32m+[m[32m{[m +[32m+[m[32m if (select == -1)[m +[32m+[m[32m select = !gtkTreeIsNodeSelected(model, iterItem); /* toggle */[m + [m +[31m- /* Check whether we have child items and it is expanded (visible) */[m +[31m- if (gtk_tree_model_iter_has_child(model, &iterItem) && gtk_tree_view_row_expanded(GTK_TREE_VIEW(ih->handle), path))[m +[31m- {[m +[31m- gtk_tree_model_iter_children(model, &iterChild, &iterItem); /* get the firstchild */[m +[31m- iterChild = gtkTreeFindVisibleNodeId(ih, model, iterChild, iterNode);[m +[32m+[m[32m gtkTreeSelectNodeRaw(model, iterItem, select);[m + [m +[31m- /* StateID founded! */[m +[31m- if(iterChild.user_data)[m +[31m- {[m +[31m- gtk_tree_path_free(path);[m +[31m- return iterChild;[m +[31m- }[m +[31m- }[m +[32m+[m[32m if (select)[m +[32m+[m[32m gtk_tree_selection_select_iter(selection, iterItem);[m +[32m+[m[32m else[m +[32m+[m[32m gtk_tree_selection_unselect_iter(selection, iterItem);[m +[32m+[m[32m}[m + [m +[31m- gtk_tree_path_free(path);[m +[31m- /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, &iterItem);[m +[32m+[m[32mstatic void gtkTreeSelectAll(Ihandle* ih, GtkTreeModel* model, GtkTreeSelection* selection, int selected)[m +[32m+[m[32m{[m +[32m+[m[32m int i;[m +[32m+[m[32m GtkTreeIter iterItem;[m +[32m+[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m gtkTreeSelectNodeRaw(model, &iterItem, selected);[m + }[m + [m +[31m- return gtkTreeInvalidIter; /* invalid since gtk_tree_model_iter_next returned false */[m +[32m+[m[32m if (selected)[m +[32m+[m[32m gtk_tree_selection_select_all(selection);[m +[32m+[m[32m else[m +[32m+[m[32m gtk_tree_selection_unselect_all(selection);[m + }[m + [m +[31m-static GtkTreeIter gtkTreeFindVisibleNodeFromId(Ihandle* ih, GtkTreeModel* model, GtkTreeIter iterItem)[m +[32m+[m[32mstatic void gtkTreeInvertAllNodeMarking(Ihandle* ih, GtkTreeModel* model, GtkTreeSelection* selection)[m + {[m +[31m- GtkTreeIter iterChild;[m +[31m- GtkTreePath* path;[m +[31m- int hasItem = TRUE;[m +[32m+[m[32m int i;[m +[32m+[m[32m GtkTreeIter iterItem;[m + [m +[31m- while(hasItem)[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m + {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control--; /* not the real id since it counts only the visible ones */[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterItem, -1);[m +[32m+[m[32m }[m +[32m+[m[32m}[m + [m +[31m- /* StateID founded! */[m +[31m- if(ih->data->id_control < 0)[m +[31m- return iterItem;[m +[32m+[m[32mstatic void gtkTreeSelectRange(Ihandle* ih, GtkTreeModel* model, GtkTreeSelection* selection, GtkTreeIter *iterItem1, GtkTreeIter *iterItem2, int clear)[m +[32m+[m[32m{[m +[32m+[m[32m int i;[m +[32m+[m[32m int id1 = iupTreeFindNodeId(ih, iterItem1->user_data);[m +[32m+[m[32m int id2 = iupTreeFindNodeId(ih, iterItem2->user_data);[m +[32m+[m[32m GtkTreeIter iterItem;[m + [m +[31m- path = gtk_tree_model_get_path(model, &iterItem);[m +[32m+[m[32m if (id1 > id2)[m +[32m+[m[32m {[m +[32m+[m[32m int tmp = id1;[m +[32m+[m[32m id1 = id2;[m +[32m+[m[32m id2 = tmp;[m +[32m+[m[32m }[m + [m +[31m- /* Check whether we have child items and it is expanded (visible) */[m +[31m- if(gtk_tree_model_iter_has_child(model, &iterItem) && gtk_tree_view_row_expanded(GTK_TREE_VIEW(ih->handle), path))[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m if (i < id1 || i > id2)[m + {[m +[31m- gtk_tree_model_iter_children(model, &iterChild, &iterItem); /* get the firstchild */[m +[31m- iterChild = gtkTreeFindVisibleNodeFromId(ih, model, iterChild);[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(ih->data->id_control < 0)[m +[31m- {[m +[31m- gtk_tree_path_free(path);[m +[31m- return iterChild;[m +[31m- }[m +[32m+[m[32m if (clear)[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterItem, 0);[m + }[m +[31m-[m +[31m- gtk_tree_path_free(path);[m +[31m- /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, &iterItem);[m +[32m+[m[32m else[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterItem, 1);[m + }[m +[31m-[m +[31m- return gtkTreeInvalidIter; /* invalid since gtk_tree_model_iter_next returned false */[m + }[m + [m +[31m-static GtkTreeIter gtkTreeGetLastVisibleNode(Ihandle* ih, GtkTreeModel* model, GtkTreeIter iterItem)[m +[32m+[m[32mstatic int gtkTreeIsNodeVisible(Ihandle* ih, GtkTreeModel* model, InodeHandle* node_handle, InodeHandle* *nodeLastParent)[m + {[m +[31m- GtkTreeIter iterChild, iterPrev = gtkTreeInvalidIter;[m +[31m- GtkTreePath* path = gtk_tree_model_get_path(model, &iterItem);[m +[31m-[m +[31m- /* Check whether we have child items and it is expanded (visible) */[m +[31m- if(gtk_tree_model_iter_has_child(model, &iterItem) && gtk_tree_view_row_expanded(GTK_TREE_VIEW(ih->handle), path))[m +[31m- {[m +[31m- int hasItem = TRUE;[m +[31m- gtk_tree_model_iter_children(model, &iterChild, &iterItem); /* get the firstchild */[m +[32m+[m[32m GtkTreeIter iterItem, iterParent;[m +[32m+[m[32m GtkTreePath* path;[m +[32m+[m[32m int is_visible;[m + [m +[31m- while(hasItem)[m +[31m- {[m +[31m- iterPrev = iterChild;[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, node_handle);[m + [m +[31m- /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, &iterChild);[m +[31m- }[m +[32m+[m[32m if (!gtk_tree_model_iter_parent(model, &iterParent, &iterItem) ||[m +[32m+[m[32m iterParent.user_data == *nodeLastParent)[m +[32m+[m[32m return 1;[m + [m +[31m- iterItem = gtkTreeGetLastVisibleNode(ih, model, iterPrev);[m +[31m- }[m +[32m+[m[32m path = gtk_tree_model_get_path(model, &iterParent);[m +[32m+[m[32m is_visible = gtk_tree_view_row_expanded(GTK_TREE_VIEW(ih->handle), path);[m + gtk_tree_path_free(path);[m + [m +[31m- return iterItem;[m +[32m+[m[32m if (!is_visible)[m +[32m+[m[32m return 0;[m +[32m+[m +[32m+[m[32m /* save last parent */[m +[32m+[m[32m *nodeLastParent = iterParent.user_data;[m +[32m+[m[32m return 1;[m + }[m + [m +[31m-static GtkTreeIter gtkTreeFindNodeID(Ihandle* ih, GtkTreeModel* model, GtkTreeIter iterItem, GtkTreeIter iterNode)[m +[32m+[m[32mstatic void gtkTreeGetLastVisibleNode(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItem)[m + {[m +[31m- GtkTreeIter iterChild;[m +[31m- int hasItem = TRUE;[m +[32m+[m[32m int i;[m +[32m+[m[32m InodeHandle* nodeLastParent = NULL;[m + [m +[31m- while(hasItem)[m +[32m+[m[32m for (i = ih->data->node_count-1; i >= 0; i--)[m + {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control++;[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if (iterItem.user_data == iterNode.user_data)[m +[31m- return iterItem;[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- if (gtk_tree_model_iter_has_child(model, &iterItem))[m +[32m+[m[32m if (gtkTreeIsNodeVisible(ih, model, ih->data->node_cache[i].node_handle, &nodeLastParent))[m + {[m +[31m- gtk_tree_model_iter_children(model, &iterChild, &iterItem); /* get the firstchild */[m +[31m- iterChild = gtkTreeFindNodeID(ih, model, iterChild, iterNode);[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(iterChild.user_data)[m +[31m- return iterChild;[m +[32m+[m[32m gtkTreeIterInit(ih, iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m return;[m + }[m +[31m-[m +[31m- /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, &iterItem);[m + }[m + [m +[31m- return gtkTreeInvalidIter; /* invalid since gtk_tree_model_iter_next returned false */[m +[32m+[m[32m gtkTreeIterInit(ih, iterItem, ih->data->node_cache[0].node_handle); /* root is always visible */[m + }[m + [m +[31m-static int gtkTreeGetNodeId(Ihandle* ih, GtkTreeIter iterItem)[m +[32m+[m[32mstatic void gtkTreeGetNextVisibleNode(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItem, int count)[m + {[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- GtkTreeIter iterRoot;[m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[31m-[m +[31m- ih->data->id_control = -1;[m +[31m- iterItem = gtkTreeFindNodeID(ih, model, iterRoot, iterItem);[m +[31m- if (iterItem.user_data)[m +[31m- return ih->data->id_control;[m +[31m- else[m +[31m- return -1;[m +[31m-}[m +[32m+[m[32m int i, id;[m +[32m+[m[32m InodeHandle* nodeLastParent = NULL;[m + [m +[31m-static GtkTreeIter gtkTreeFindUserData(Ihandle* ih, GtkTreeModel* model, GtkTreeIter iterItem, void* userdata)[m +[31m-{[m +[31m- GtkTreeIter iterChild;[m +[31m- int hasItem = TRUE;[m +[31m- void* node_userdata;[m +[32m+[m[32m id = iupTreeFindNodeId(ih, iterItem->user_data);[m +[32m+[m[32m id += count;[m + [m +[31m- while(hasItem)[m +[32m+[m[32m for (i = id; i < ih->data->node_count; i++)[m + {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control++;[m +[32m+[m[32m if (gtkTreeIsNodeVisible(ih, model, ih->data->node_cache[i].node_handle, &nodeLastParent))[m +[32m+[m[32m {[m +[32m+[m[32m gtkTreeIterInit(ih, iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m return;[m +[32m+[m[32m }[m +[32m+[m[32m }[m + [m +[31m- gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_USERDATA, &node_userdata, -1);[m +[32m+[m[32m gtkTreeIterInit(ih, iterItem, ih->data->node_cache[0].node_handle); /* root is always visible */[m +[32m+[m[32m}[m + [m +[31m- /* userdata founded! */[m +[31m- if (node_userdata == userdata)[m +[31m- return iterItem;[m +[32m+[m[32mstatic void gtkTreeGetPreviousVisibleNode(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItem, int count)[m +[32m+[m[32m{[m +[32m+[m[32m int i, id;[m +[32m+[m[32m InodeHandle* nodeLastParent = NULL;[m + [m +[31m- /* Check whether we have child items */[m +[31m- if (gtk_tree_model_iter_has_child(model, &iterItem))[m +[31m- {[m +[31m- gtk_tree_model_iter_children(model, &iterChild, &iterItem); /* get the firstchild */[m +[31m- iterChild = gtkTreeFindUserData(ih, model, iterChild, userdata);[m +[32m+[m[32m id = iupTreeFindNodeId(ih, iterItem->user_data);[m +[32m+[m[32m id -= count;[m + [m +[31m- /* userdata founded! */[m +[31m- if (iterChild.user_data)[m +[31m- return iterChild;[m +[32m+[m[32m for (i = id; i >= 0; i--)[m +[32m+[m[32m {[m +[32m+[m[32m if (gtkTreeIsNodeVisible(ih, model, ih->data->node_cache[i].node_handle, &nodeLastParent))[m +[32m+[m[32m {[m +[32m+[m[32m gtkTreeIterInit(ih, iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m return;[m + }[m +[31m-[m +[31m- /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, &iterItem);[m + }[m + [m +[31m- return gtkTreeInvalidIter; /* invalid since gtk_tree_model_iter_next returned false */[m +[32m+[m[32m gtkTreeGetLastVisibleNode(ih, model, iterItem);[m + }[m + [m +[31m-static int gtkTreeGetUserDataId(Ihandle* ih, GtkTreeModel* model, void* userdata)[m +[32m+[m[32mstatic int gtkTreeFindNodeId(Ihandle* ih, GtkTreeIter* iterItem)[m + {[m +[31m- GtkTreeIter iterRoot, iterItem;[m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[31m-[m +[31m- ih->data->id_control = -1;[m +[31m- iterItem = gtkTreeFindUserData(ih, model, iterRoot, userdata);[m +[31m- if (iterItem.user_data)[m +[31m- return ih->data->id_control;[m +[31m- else[m +[31m- return -1;[m +[32m+[m[32m return iupTreeFindNodeId(ih, iterItem->user_data);[m + }[m + [m +[31m-static void gtkTreeCallNodeRemovedRec(Ihandle* ih, GtkTreeModel* model, GtkTreeIter iterItem, IFnis cb)[m +[32m+[m[32mstatic void gtkTreeCallNodeRemovedRec(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItem, IFns cb, int *id)[m + {[m + GtkTreeIter iterChild;[m +[31m- int hasItem = TRUE;[m +[31m- void* node_userdata;[m +[32m+[m[32m int hasItem;[m +[32m+[m[32m int old_id = *id;[m + [m +[32m+[m[32m /* Check whether we have child items */[m +[32m+[m[32m /* remove from children first */[m +[32m+[m[32m hasItem = gtk_tree_model_iter_children(model, &iterChild, iterItem); /* get the firstchild */[m + while(hasItem)[m + {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control++;[m +[31m-[m +[31m- gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_USERDATA, &node_userdata, -1);[m +[31m-[m +[31m- cb(ih, ih->data->id_control, (char*)node_userdata);[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- if (gtk_tree_model_iter_has_child(model, &iterItem))[m +[31m- {[m +[31m- gtk_tree_model_iter_children(model, &iterChild, &iterItem); /* get the firstchild */[m +[31m- gtkTreeCallNodeRemovedRec(ih, model, iterChild, cb);[m +[31m- }[m +[32m+[m[32m /* go recursive to children */[m +[32m+[m[32m gtkTreeCallNodeRemovedRec(ih, model, &iterChild, cb, id);[m + [m + /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, &iterItem);[m +[32m+[m[32m hasItem = gtk_tree_model_iter_next(model, &iterChild);[m + }[m +[32m+[m +[32m+[m[32m /* actually do it for the node */[m +[32m+[m[32m ih->data->node_count--;[m +[32m+[m[32m (*id)++;[m +[32m+[m +[32m+[m[32m cb(ih, (char*)ih->data->node_cache[old_id].userdata);[m + }[m + [m + static void gtkTreeCallNodeRemoved(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItem)[m + {[m +[31m- IFnis cb = (IFnis)IupGetCallback(ih, "NODEREMOVED_CB");[m +[32m+[m[32m int old_count = ih->data->node_count;[m +[32m+[m[32m int id = iupTreeFindNodeId(ih, iterItem->user_data);[m +[32m+[m[32m int old_id = id;[m +[32m+[m +[32m+[m[32m IFns cb = (IFns)IupGetCallback(ih, "NODEREMOVED_CB");[m + if (cb) [m +[32m+[m[32m gtkTreeCallNodeRemovedRec(ih, model, iterItem, cb, &id);[m +[32m+[m[32m else[m + {[m +[31m- ih->data->id_control = gtkTreeGetNodeId(ih, *iterItem)-1;[m +[31m- gtkTreeCallNodeRemovedRec(ih, model, *iterItem, cb);[m +[32m+[m[32m int removed_count = iupdrvTreeTotalChildCount(ih, iterItem->user_data)+1;[m +[32m+[m[32m ih->data->node_count -= removed_count;[m + }[m +[32m+[m +[32m+[m[32m iupTreeDelFromCache(ih, old_id, old_count-ih->data->node_count);[m + }[m + [m +[31m-static gboolean gtkTreeFindNodeFromID(Ihandle* ih, GtkTreeModel* model, GtkTreeIter *iterItem, int *id)[m +[32m+[m[32mstatic void gtkTreeCallNodeRemovedAll(Ihandle* ih)[m + {[m +[31m- GtkTreeIter iterChild;[m +[31m- int hasItem = TRUE;[m +[32m+[m[32m IFns cb = (IFns)IupGetCallback(ih, "NODEREMOVED_CB");[m +[32m+[m[32m int i, old_count = ih->data->node_count;[m + [m +[31m- while(hasItem)[m +[32m+[m[32m if (cb)[m + {[m +[31m- /* ID control to traverse items */[m +[31m- (*id)--;[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if (*id < 0)[m +[31m- return TRUE;[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- if (gtk_tree_model_iter_has_child(model, iterItem))[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m + {[m +[31m- gtk_tree_model_iter_children(model, &iterChild, iterItem); /* get the firstchild */[m +[31m- [m +[31m- if (gtkTreeFindNodeFromID(ih, model, &iterChild, id))[m +[31m- {[m +[31m- *iterItem = iterChild;[m +[31m- return TRUE;[m +[31m- }[m +[32m+[m[32m cb(ih, (char*)ih->data->node_cache[i].userdata);[m + }[m +[31m-[m +[31m- /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, iterItem);[m + }[m + [m +[31m- return FALSE;[m +[32m+[m[32m ih->data->node_count = 0;[m +[32m+[m +[32m+[m[32m iupTreeDelFromCache(ih, 0, old_count);[m + }[m + [m +[31m-static gboolean gtkTreeFindNodeFromString(Ihandle* ih, GtkTreeModel* model, const char* name_id, GtkTreeIter *iterItem)[m +[32m+[m[32mstatic gboolean gtkTreeFindNodeFromString(Ihandle* ih, const char* name_id, GtkTreeIter *iterItem)[m + {[m +[31m- if (name_id[0])[m +[31m- {[m +[31m- int id;[m +[31m- if (iupStrToInt(name_id, &id))[m +[31m- {[m +[31m- gtk_tree_model_get_iter_first(model, iterItem);[m +[31m- return gtkTreeFindNodeFromID(ih, model, iterItem, &id);[m +[31m- }[m +[31m- }[m +[31m- else[m +[31m- {[m +[31m- GtkTreePath* path = NULL;[m +[31m- gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &path, NULL);[m +[31m- if (path)[m +[31m- {[m +[31m- gtk_tree_model_get_iter(model, iterItem, path);[m +[31m- gtk_tree_path_free(path);[m +[31m- return TRUE;[m +[31m- }[m +[31m- }[m +[31m- return FALSE;[m +[32m+[m[32m InodeHandle* node_handle = iupTreeGetNodeFromString(ih, name_id);[m +[32m+[m[32m if (!node_handle)[m +[32m+[m[32m return FALSE;[m +[32m+[m +[32m+[m[32m gtkTreeIterInit(ih, iterItem, node_handle);[m +[32m+[m[32m return TRUE;[m + }[m + [m + /*****************************************************************************/[m + /* MANIPULATING IMAGES */[m + /*****************************************************************************/[m +[31m-static void gtkTreeUpdateImages(Ihandle* ih, GtkTreeModel* model, GtkTreeIter iterItem, int mode)[m +[32m+[m[32mstatic void gtkTreeUpdateImages(Ihandle* ih, int mode)[m + {[m +[31m- GtkTreeIter iterChild;[m +[31m- int hasItem = TRUE;[m +[31m- int kind;[m +[32m+[m[32m GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m GtkTreeIter iterItem;[m +[32m+[m[32m int i, kind;[m + [m +[31m- while(hasItem)[m +[32m+[m[32m for (i=0; i<ih->data->node_count; i++)[m + {[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m + gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_KIND, &kind, -1);[m + [m + if (kind == ITREE_BRANCH)[m +[36m@@ -480,14 +468,6 @@[m [mstatic void gtkTreeUpdateImages(Ihandle* ih, GtkTreeModel* model, GtkTreeIter it[m + if (!has_image)[m + gtk_tree_store_set(GTK_TREE_STORE(model), &iterItem, IUPGTK_TREE_IMAGE, ih->data->def_image_collapsed, -1);[m + }[m +[31m-[m +[31m- if (gtk_tree_model_iter_has_child(model, &iterItem))[m +[31m- {[m +[31m-[m +[31m- /* Recursively traverse child items */[m +[31m- gtk_tree_model_iter_children(model, &iterChild, &iterItem);[m +[31m- gtkTreeUpdateImages(ih, model, iterChild, mode);[m +[31m- }[m + }[m + else [m + {[m +[36m@@ -499,9 +479,6 @@[m [mstatic void gtkTreeUpdateImages(Ihandle* ih, GtkTreeModel* model, GtkTreeIter it[m + gtk_tree_store_set(GTK_TREE_STORE(model), &iterItem, IUPGTK_TREE_IMAGE, ih->data->def_image_leaf, -1);[m + }[m + }[m +[31m-[m +[31m- /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, &iterItem);[m + }[m + }[m + [m +[36m@@ -536,26 +513,49 @@[m [mvoid iupdrvTreeAddNode(Ihandle* ih, const char* name_id, int kind, const char* t[m + GtkTreeIter iterPrev, iterNewItem, iterParent;[m + GtkTreePath* path;[m + GdkColor color = {0L,0,0,0};[m +[31m- int kindPrev;[m +[31m-[m +[31m- if (!gtkTreeFindNodeFromString(ih, GTK_TREE_MODEL(store), name_id, &iterPrev))[m +[31m- return;[m +[32m+[m[32m int kindPrev = -1;[m + [m +[31m- gtk_tree_model_get(GTK_TREE_MODEL(store), &iterPrev, IUPGTK_TREE_KIND, &kindPrev, -1);[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterPrev))[m +[32m+[m[32m {[m +[32m+[m[32m /* check if the root was really specified */[m +[32m+[m[32m int id = 0;[m +[32m+[m[32m if (!iupStrToInt(name_id, &id) || id != -1)[m +[32m+[m[32m return;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m gtk_tree_model_get(GTK_TREE_MODEL(store), &iterPrev, IUPGTK_TREE_KIND, &kindPrev, -1);[m + [m +[31m- if (kindPrev == ITREE_BRANCH && add)[m +[31m- gtk_tree_store_insert(store, &iterNewItem, &iterPrev, 0); /* iterPrev is parent of the new item (firstchild of it) */[m +[32m+[m[32m if (kindPrev != -1)[m +[32m+[m[32m {[m +[32m+[m[32m /* Add the new node */[m +[32m+[m[32m if (kindPrev == ITREE_BRANCH && add)[m +[32m+[m[32m gtk_tree_store_insert(store, &iterNewItem, &iterPrev, 0); /* iterPrev is parent of the new item (firstchild of it) */[m +[32m+[m[32m else[m +[32m+[m[32m gtk_tree_store_insert_after(store, &iterNewItem, NULL, &iterPrev); /* iterPrev is sibling of the new item */[m +[32m+[m[32m iupTreeAddToCache(ih, add, kindPrev, iterPrev.user_data, iterNewItem.user_data);[m +[32m+[m[32m }[m + else[m +[31m- gtk_tree_store_insert_after(store, &iterNewItem, NULL, &iterPrev); /* iterPrev is sibling of the new item */[m +[32m+[m[32m {[m +[32m+[m[32m gtk_tree_store_append(store, &iterNewItem, NULL); /* root node */[m +[32m+[m[32m iupTreeAddToCache(ih, 0, 0, NULL, iterNewItem.user_data);[m +[32m+[m +[32m+[m[32m /* store the stamp for the tree */[m +[32m+[m[32m ih->data->stamp = iterNewItem.stamp;[m +[32m+[m[32m }[m + [m + iupgtkGetColor(iupAttribGetStr(ih, "FGCOLOR"), &color);[m + [m +[32m+[m[32m if (!title)[m +[32m+[m[32m title = "";[m +[32m+[m + /* set the attributes of the new node */[m + gtk_tree_store_set(store, &iterNewItem, IUPGTK_TREE_HAS_IMAGE, FALSE,[m + IUPGTK_TREE_HAS_IMAGE_EXPANDED, FALSE,[m + IUPGTK_TREE_TITLE, iupgtkStrConvertToUTF8(title),[m + IUPGTK_TREE_KIND, kind,[m +[31m- IUPGTK_TREE_COLOR, &color, -1);[m +[32m+[m[32m IUPGTK_TREE_COLOR, &color,[m[41m [m +[32m+[m[32m IUPGTK_TREE_SELECT, 0,[m +[32m+[m[32m -1);[m + [m + if (kind == ITREE_LEAF)[m + gtk_tree_store_set(store, &iterNewItem, IUPGTK_TREE_IMAGE, ih->data->def_image_leaf, -1);[m +[36m@@ -563,56 +563,113 @@[m [mvoid iupdrvTreeAddNode(Ihandle* ih, const char* name_id, int kind, const char* t[m + gtk_tree_store_set(store, &iterNewItem, IUPGTK_TREE_IMAGE, ih->data->def_image_collapsed,[m + IUPGTK_TREE_IMAGE_EXPANDED, ih->data->def_image_expanded, -1);[m + [m +[31m- if (kindPrev == ITREE_BRANCH && add)[m +[31m- iterParent = iterPrev;[m +[31m- else[m +[31m- gtk_tree_model_iter_parent(GTK_TREE_MODEL(store), &iterParent, &iterNewItem);[m +[32m+[m[32m if (kindPrev != -1)[m +[32m+[m[32m {[m +[32m+[m[32m if (kindPrev == ITREE_BRANCH && add)[m +[32m+[m[32m iterParent = iterPrev;[m +[32m+[m[32m else if (!gtk_tree_model_iter_parent(GTK_TREE_MODEL(store), &iterParent, &iterNewItem))[m +[32m+[m[32m return;[m + [m +[31m- /* If this is the first child of the parent, then handle the ADDEXPANDED attribute */[m +[31m- if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), &iterParent) == 1)[m +[32m+[m[32m /* If this is the first child of the parent, then handle the ADDEXPANDED attribute */[m +[32m+[m[32m if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), &iterParent) == 1)[m +[32m+[m[32m {[m +[32m+[m[32m path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iterParent);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_BRANCH_CB", "1");[m +[32m+[m[32m if (ih->data->add_expanded)[m +[32m+[m[32m gtk_tree_view_expand_row(GTK_TREE_VIEW(ih->handle), path, FALSE);[m +[32m+[m[32m else[m +[32m+[m[32m gtk_tree_view_collapse_row(GTK_TREE_VIEW(ih->handle), path);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_BRANCH_CB", NULL);[m +[32m+[m[32m gtk_tree_path_free(path);[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m[32m else[m + {[m +[31m- int depth;[m +[31m- path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iterParent);[m +[31m- depth = gtk_tree_path_get_depth(path)-1;[m +[31m- if (ih->data->add_expanded || depth==0) /* if this is the first child of the root, expand always */[m +[32m+[m[32m if (ih->data->node_count == 1)[m + {[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_BRANCHOPEN_CB", "1");[m +[31m- gtk_tree_view_expand_row(GTK_TREE_VIEW(ih->handle), path, FALSE);[m +[32m+[m[32m /* MarkStart node */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_MARKSTART_NODE", (char*)iterNewItem.user_data);[m +[32m+[m +[32m+[m[32m /* Set the default VALUE */[m +[32m+[m[32m path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iterNewItem);[m +[32m+[m[32m gtk_tree_view_set_cursor(GTK_TREE_VIEW(ih->handle), path, NULL, FALSE);[m +[32m+[m[32m gtk_tree_path_free(path);[m + }[m +[31m- else[m +[31m- gtk_tree_view_collapse_row(GTK_TREE_VIEW(ih->handle), path);[m +[31m- gtk_tree_path_free(path);[m + }[m + }[m + [m +[31m-static void gtkTreeAddRootNode(Ihandle* ih)[m +[32m+[m +[32m+[m[32m/*****************************************************************************/[m +[32m+[m[32m/* AUXILIAR FUNCTIONS */[m +[32m+[m[32m/*****************************************************************************/[m +[32m+[m +[32m+[m +[32m+[m[32mstatic void gtkTreeChildRebuildCacheRec(Ihandle* ih, GtkTreeModel *model, GtkTreeIter *iterItem, int *id)[m + {[m +[31m- GtkTreeStore* store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle)));[m +[31m- GtkTreePath* path;[m +[31m- GtkTreeIter iterRoot;[m +[31m- GdkColor color = {0L,0,0,0};[m +[32m+[m[32m GtkTreeIter iterChild;[m +[32m+[m[32m int hasItem = gtk_tree_model_iter_children(model, &iterChild, iterItem); /* get the firstchild */[m +[32m+[m[32m while(hasItem)[m +[32m+[m[32m {[m +[32m+[m[32m (*id)++;[m +[32m+[m[32m ih->data->node_cache[*id].node_handle = iterChild.user_data;[m + [m +[31m- iupgtkGetColor(iupAttribGetStr(ih, "FGCOLOR"), &color);[m +[32m+[m[32m /* go recursive to children */[m +[32m+[m[32m gtkTreeChildRebuildCacheRec(ih, model, &iterChild, id);[m +[32m+[m +[32m+[m[32m /* Go to next sibling item */[m +[32m+[m[32m hasItem = gtk_tree_model_iter_next(model, &iterChild);[m +[32m+[m[32m }[m +[32m+[m[32m}[m + [m +[31m- gtk_tree_store_append(store, &iterRoot, NULL); /* root node */[m +[31m- gtk_tree_store_set(store, &iterRoot, IUPGTK_TREE_IMAGE, ih->data->def_image_collapsed,[m +[31m- IUPGTK_TREE_HAS_IMAGE, FALSE,[m +[31m- IUPGTK_TREE_IMAGE_EXPANDED, ih->data->def_image_expanded,[m +[31m- IUPGTK_TREE_HAS_IMAGE_EXPANDED, FALSE,[m +[31m- IUPGTK_TREE_KIND, ITREE_BRANCH,[m +[31m- IUPGTK_TREE_COLOR, &color, -1);[m +[32m+[m[32mstatic void gtkTreeRebuildNodeCache(Ihandle* ih, int id, GtkTreeIter iterItem)[m +[32m+[m[32m{[m +[32m+[m[32m GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m ih->data->node_cache[id].node_handle = iterItem.user_data;[m +[32m+[m[32m gtkTreeChildRebuildCacheRec(ih, model, &iterItem, &id);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void gtkTreeChildCountRec(GtkTreeModel *model, GtkTreeIter *iterItem, int *count)[m +[32m+[m[32m{[m +[32m+[m[32m GtkTreeIter iterChild;[m +[32m+[m[32m int hasItem = gtk_tree_model_iter_children(model, &iterChild, iterItem); /* get the firstchild */[m +[32m+[m[32m while(hasItem)[m +[32m+[m[32m {[m +[32m+[m[32m (*count)++;[m + [m +[31m- path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iterRoot);[m +[31m- /* MarkStart node */[m +[31m- iupAttribSetStr(ih, "_IUPTREE_MARKSTART_NODE", (char*)path);[m +[32m+[m[32m /* go recursive to children */[m +[32m+[m[32m gtkTreeChildCountRec(model, &iterChild, count);[m + [m +[31m- /* Set the default VALUE */[m +[31m- gtk_tree_view_set_cursor(GTK_TREE_VIEW(ih->handle), path, NULL, FALSE);[m +[32m+[m[32m /* Go to next sibling item */[m +[32m+[m[32m hasItem = gtk_tree_model_iter_next(model, &iterChild);[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mint iupdrvTreeTotalChildCount(Ihandle* ih, InodeHandle* node_handle)[m +[32m+[m[32m{[m +[32m+[m[32m int count = 0;[m +[32m+[m[32m GtkTreeIter iterItem;[m +[32m+[m[32m GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, node_handle);[m +[32m+[m[32m gtkTreeChildCountRec(model, &iterItem, &count);[m +[32m+[m[32m return count;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mInodeHandle* iupdrvTreeGetFocusNode(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m GtkTreePath* path = NULL;[m +[32m+[m[32m gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &path, NULL);[m +[32m+[m[32m if (path)[m +[32m+[m[32m {[m +[32m+[m[32m GtkTreeIter iterItem;[m +[32m+[m[32m GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m gtk_tree_model_get_iter(model, &iterItem, path);[m +[32m+[m[32m gtk_tree_path_free(path);[m +[32m+[m[32m return iterItem.user_data;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m return NULL;[m + }[m + [m +[31m-/*****************************************************************************/[m +[31m-/* AUXILIAR FUNCTIONS */[m +[31m-/*****************************************************************************/[m + static void gtkTreeOpenCloseEvent(Ihandle* ih)[m + {[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[36m@@ -620,7 +677,7 @@[m [mstatic void gtkTreeOpenCloseEvent(Ihandle* ih)[m + GtkTreePath* path;[m + int kind;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, "", &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, "", &iterItem))[m + return;[m + [m + path = gtk_tree_model_get_path(model, &iterItem);[m +[36m@@ -637,27 +694,22 @@[m [mstatic void gtkTreeOpenCloseEvent(Ihandle* ih)[m + }[m + }[m + [m +[31m-static gboolean gtkTreeSelected_Foreach_Func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, GList **rowref_list)[m +[32m+[m[32mtypedef struct _gtkTreeSelectMinMax[m + {[m +[31m- GtkTreeRowReference *rowref;[m +[31m-[m +[31m- rowref = gtk_tree_row_reference_new(model, path);[m +[31m- *rowref_list = g_list_append(*rowref_list, rowref);[m +[32m+[m[32m Ihandle* ih;[m +[32m+[m[32m int id1, id2;[m +[32m+[m[32m} gtkTreeSelectMinMax;[m + [m +[31m- (void)iter;[m +[31m- return FALSE; /* do not stop walking the store, call us with next row */[m +[31m-}[m +[31m-[m +[31m-static gboolean gtkTreeSelected_Iter_Func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, GList **rowref_list)[m +[32m+[m[32mstatic gboolean gtkTreeSelected_Foreach_Func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iterItem, gtkTreeSelectMinMax *minmax)[m + {[m +[31m- GtkTreeRowReference *rowref;[m +[31m- GtkTreeIter iterParent;[m +[31m- if (!gtk_tree_model_iter_parent(model, &iterParent, iter)) /* the root node can't be deleted */[m +[31m- return FALSE; /* do not stop walking the store, call us with next row */[m +[31m-[m +[31m- rowref = gtk_tree_row_reference_new(model, path);[m +[31m- *rowref_list = g_list_append(*rowref_list, rowref);[m +[32m+[m[32m int id = iupTreeFindNodeId(minmax->ih, iterItem->user_data);[m +[32m+[m[32m if (id < minmax->id1)[m +[32m+[m[32m minmax->id1 = id;[m +[32m+[m[32m if (id > minmax->id2)[m +[32m+[m[32m minmax->id2 = id;[m + [m +[32m+[m[32m (void)model;[m +[32m+[m[32m (void)path;[m + return FALSE; /* do not stop walking the store, call us with next row */[m + }[m + [m +[36m@@ -672,45 +724,48 @@[m [mstatic void gtkTreeCallMultiSelectionCb(Ihandle* ih)[m + {[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));[m +[31m- GtkTreeIter iterRoot;[m +[31m- GList *rr_list = NULL;[m +[31m- GList *node;[m +[31m- int* id_rowItem;[m +[31m- int count_selected_rows, i = 0;[m +[32m+[m[32m GtkTreeIter iterItem;[m +[32m+[m[32m int i = 0, countItems;[m +[32m+[m[32m gtkTreeSelectMinMax minmax;[m + [m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[32m+[m[32m minmax.ih = ih;[m +[32m+[m[32m minmax.id1 = ih->data->node_count;[m +[32m+[m[32m minmax.id2 = -1;[m + [m +[31m- gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)gtkTreeSelected_Foreach_Func, &rr_list);[m +[31m- count_selected_rows = g_list_length(rr_list);[m +[31m- id_rowItem = malloc(sizeof(int) * count_selected_rows);[m +[32m+[m[32m gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)gtkTreeSelected_Foreach_Func, &minmax);[m +[32m+[m[32m if (minmax.id2 == -1)[m +[32m+[m[32m return;[m + [m +[31m- for(node = rr_list; node != NULL; node = node->next)[m +[32m+[m[32m /* interactive selection of several nodes will NOT select hidden nodes,[m +[32m+[m[32m so make sure that they are selected. */[m +[32m+[m[32m for(i = minmax.id1; i <= minmax.id2; i++)[m + {[m +[31m- GtkTreePath* path = gtk_tree_row_reference_get_path(node->data);[m +[31m- if (path)[m +[31m- {[m +[31m- GtkTreeIter iterItem;[m +[31m- gtk_tree_model_get_iter(model, &iterItem, path);[m +[31m-[m +[31m- id_rowItem[i] = gtkTreeGetNodeId(ih, iterItem);[m +[31m- i++;[m +[31m-[m +[31m- gtk_tree_path_free(path);[m +[31m- }[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m if (!gtkTreeIsNodeSelected(model, &iterItem))[m +[32m+[m[32m gtkTreeSelectNodeRaw(model, &iterItem, 1);[m + }[m + [m +[31m- g_list_foreach(rr_list, (GFunc) gtk_tree_row_reference_free, NULL);[m +[31m- g_list_free(rr_list);[m +[32m+[m[32m /* if last selected item is a branch, then select its children */[m +[32m+[m[32m iupTreeSelectLastCollapsedBranch(ih, &(minmax.id2));[m +[32m+[m +[32m+[m[32m countItems = minmax.id2-minmax.id1+1;[m + [m + if (cbMulti)[m +[31m- cbMulti(ih, id_rowItem, count_selected_rows);[m +[31m- else[m + {[m +[31m- for (i=0; i<count_selected_rows; i++)[m +[31m- cbSelec(ih, id_rowItem[i], 1);[m +[31m- }[m +[32m+[m[32m int* id_rowItem = malloc(sizeof(int) * countItems);[m +[32m+[m +[32m+[m[32m for(i = 0; i < countItems; i++)[m +[32m+[m[32m id_rowItem[i] = minmax.id1+i;[m + [m +[31m- free(id_rowItem);[m +[32m+[m[32m cbMulti(ih, id_rowItem, countItems);[m +[32m+[m +[32m+[m[32m free(id_rowItem);[m +[32m+[m[32m }[m +[32m+[m[32m else if (cbSelec)[m +[32m+[m[32m {[m +[32m+[m[32m for (i=0; i<countItems; i++)[m +[32m+[m[32m cbSelec(ih, minmax.id1+i, 1);[m +[32m+[m[32m }[m + }[m + }[m + [m +[36m@@ -747,14 +802,22 @@[m [mstatic int gtkTreeSetTopItemAttrib(Ihandle* ih, const char* value)[m + GtkTreeStore* store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle)));[m + GtkTreeIter iterItem;[m + GtkTreePath* path;[m +[32m+[m[32m int kind;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, GTK_TREE_MODEL(store), value, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, value, &iterItem))[m + return 0;[m + [m + path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iterItem);[m + [m +[31m- if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(ih->handle), path))[m +[32m+[m[32m gtk_tree_model_get(GTK_TREE_MODEL(store), &iterItem, IUPGTK_TREE_KIND, &kind, -1);[m +[32m+[m[32m if (kind == ITREE_LEAF)[m +[32m+[m[32m gtk_tree_view_expand_to_path(GTK_TREE_VIEW(ih->handle), path);[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m int expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(ih->handle), path);[m + gtk_tree_view_expand_to_path(GTK_TREE_VIEW(ih->handle), path);[m +[32m+[m[32m if (!expanded) gtk_tree_view_collapse_row(GTK_TREE_VIEW(ih->handle), path);[m +[32m+[m[32m }[m + [m + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ih->handle), path, NULL, FALSE, 0, 0); /* scroll to visible */[m + [m +[36m@@ -788,34 +851,23 @@[m [mstatic int gtkTreeSetExpandAllAttrib(Ihandle* ih, const char* value)[m + if (iupStrBoolean(value))[m + gtk_tree_view_expand_all(GTK_TREE_VIEW(ih->handle));[m + else[m +[31m- {[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- GtkTreeIter iterRoot;[m +[31m- GtkTreePath* pathRoot;[m +[31m-[m + gtk_tree_view_collapse_all(GTK_TREE_VIEW(ih->handle));[m + [m +[31m- /* The root node is always expanded */[m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[31m- pathRoot = gtk_tree_model_get_path(model, &iterRoot);[m +[31m- gtk_tree_view_expand_row(GTK_TREE_VIEW(ih->handle), pathRoot, FALSE);[m +[31m- gtk_tree_path_free(pathRoot);[m +[31m- }[m +[31m-[m + return 0;[m + }[m + [m + static char* gtkTreeGetDepthAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- char* depth;[m +[32m+[m[32m char* str;[m + GtkTreeStore* store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle)));[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, GTK_TREE_MODEL(store), name_id, &iterItem))[m +[32m+[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return NULL;[m + [m +[31m- depth = iupStrGetMemory(10);[m +[31m- sprintf(depth, "%d", gtk_tree_store_iter_depth(store, &iterItem));[m +[31m- return depth;[m +[32m+[m[32m str = iupStrGetMemory(10);[m +[32m+[m[32m sprintf(str, "%d", gtk_tree_store_iter_depth(store, &iterItem));[m +[32m+[m[32m return str;[m + }[m + [m + static int gtkTreeSetMoveNodeAttrib(Ihandle* ih, const char* name_id, const char* value)[m +[36m@@ -824,14 +876,14 @@[m [mstatic int gtkTreeSetMoveNodeAttrib(Ihandle* ih, const char* name_id, const char[m + GtkTreeIter iterItemSrc, iterItemDst, iterNewItem;[m + GtkTreeIter iterParent, iterNextParent;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + [m + model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItemSrc))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItemSrc))[m + return 0;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, value, &iterItemDst))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, value, &iterItemDst))[m + return 0;[m + [m + /* If Drag item is an ancestor of Drop item then return */[m +[36m@@ -843,12 +895,8 @@[m [mstatic int gtkTreeSetMoveNodeAttrib(Ihandle* ih, const char* name_id, const char[m + iterParent = iterNextParent;[m + }[m + [m +[31m- /* Copying the node and its children to the new position */[m +[31m- gtkTreeCopyNode(ih, model, &iterItemSrc, &iterItemDst, &iterNewItem, 0); /* not a full copy, preserve user data */[m +[31m-[m +[31m- /* Deleting the node of its old position */[m +[31m- /* do not delete the user data, we copy the references in CopyNode */[m +[31m- gtk_tree_store_remove(GTK_TREE_STORE(model), &iterItemSrc);[m +[32m+[m[32m /* Move the node and its children to the new position */[m +[32m+[m[32m gtkTreeCopyMoveNode(ih, model, &iterItemSrc, &iterItemDst, &iterNewItem, 0);[m + [m + return 0;[m + }[m +[36m@@ -859,14 +907,14 @@[m [mstatic int gtkTreeSetCopyNodeAttrib(Ihandle* ih, const char* name_id, const char[m + GtkTreeIter iterItemSrc, iterItemDst, iterNewItem;[m + GtkTreeIter iterParent, iterNextParent;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + [m + model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItemSrc))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItemSrc))[m + return 0;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, value, &iterItemDst))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, value, &iterItemDst))[m + return 0;[m + [m + /* If Drag item is an ancestor of Drop item then return */[m +[36m@@ -878,8 +926,8 @@[m [mstatic int gtkTreeSetCopyNodeAttrib(Ihandle* ih, const char* name_id, const char[m + iterParent = iterNextParent;[m + }[m + [m +[31m- /* Copying the node and its children to the new position */[m +[31m- gtkTreeCopyNode(ih, model, &iterItemSrc, &iterItemDst, &iterNewItem, 1);[m +[32m+[m[32m /* Copy the node and its children to the new position */[m +[32m+[m[32m gtkTreeCopyMoveNode(ih, model, &iterItemSrc, &iterItemDst, &iterNewItem, 1);[m + [m + return 0;[m + }[m +[36m@@ -891,7 +939,7 @@[m [mstatic char* gtkTreeGetColorAttrib(Ihandle* ih, const char* name_id)[m + GtkTreeIter iterItem;[m + GdkColor *color;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return NULL;[m + [m + gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_COLOR, &color, -1);[m +[36m@@ -912,7 +960,7 @@[m [mstatic int gtkTreeSetColorAttrib(Ihandle* ih, const char* name_id, const char* v[m + GdkColor color;[m + unsigned char r, g, b;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, GTK_TREE_MODEL(store), name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + [m + if (!iupStrToRGB(value, &r, &g, &b))[m +[36m@@ -931,14 +979,14 @@[m [mstatic char* gtkTreeGetParentAttrib(Ihandle* ih, const char* name_id)[m + GtkTreeIter iterParent;[m + char* str;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return NULL;[m + [m + if (!gtk_tree_model_iter_parent(model, &iterParent, &iterItem))[m + return NULL;[m + [m + str = iupStrGetMemory(10);[m +[31m- sprintf(str, "%d", gtkTreeGetNodeId(ih, iterParent));[m +[32m+[m[32m sprintf(str, "%d", gtkTreeFindNodeId(ih, &iterParent));[m + return str;[m + }[m + [m +[36m@@ -948,7 +996,7 @@[m [mstatic char* gtkTreeGetChildCountAttrib(Ihandle* ih, const char* name_id)[m + GtkTreeIter iterItem;[m + char* str;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return NULL;[m + [m + str = iupStrGetMemory(10);[m +[36m@@ -956,40 +1004,13 @@[m [mstatic char* gtkTreeGetChildCountAttrib(Ihandle* ih, const char* name_id)[m + return str;[m + }[m + [m +[31m-static int gtkTreeCount(GtkTreeModel* model, GtkTreeIter iterBranch)[m +[31m-{[m +[31m- GtkTreeIter iterChild;[m +[31m- int count = 0;[m +[31m- int hasItem = gtk_tree_model_iter_children(model, &iterChild, &iterBranch); /* get the firstchild */[m +[31m- count++;[m +[31m- while(hasItem)[m +[31m- {[m +[31m- count += gtkTreeCount(model, iterChild);[m +[31m-[m +[31m- /* Go to next sibling item */[m +[31m- hasItem = gtk_tree_model_iter_next(model, &iterChild);[m +[31m- }[m +[31m-[m +[31m- return count;[m +[31m-}[m +[31m-[m +[31m-static char* gtkTreeGetCountAttrib(Ihandle* ih)[m +[31m-{[m +[31m- GtkTreeIter iterRoot;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- char* str = iupStrGetMemory(10);[m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[31m- sprintf(str, "%d", gtkTreeCount(model, iterRoot));[m +[31m- return str;[m +[31m-}[m +[31m-[m + static char* gtkTreeGetKindAttrib(Ihandle* ih, const char* name_id)[m + {[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeIter iterItem;[m + int kind;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return NULL;[m + [m + gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_KIND, &kind, -1);[m +[36m@@ -1005,7 +1026,7 @@[m [mstatic char* gtkTreeGetStateAttrib(Ihandle* ih, const char* name_id)[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeIter iterItem;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return NULL;[m + [m + if (gtk_tree_model_iter_has_child(model, &iterItem))[m +[36m@@ -1028,13 +1049,20 @@[m [mstatic int gtkTreeSetStateAttrib(Ihandle* ih, const char* name_id, const char* v[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeIter iterItem;[m + GtkTreePath* path;[m +[32m+[m[32m int kind;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + [m +[31m- path = gtk_tree_model_get_path(model, &iterItem);[m +[31m- gtkTreeExpandItem(ih, path, iupStrEqualNoCase(value, "EXPANDED"));[m +[31m- gtk_tree_path_free(path);[m +[32m+[m[32m gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_KIND, &kind, -1);[m +[32m+[m[32m if (kind == ITREE_BRANCH)[m +[32m+[m[32m {[m +[32m+[m[32m path = gtk_tree_model_get_path(model, &iterItem);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_BRANCH_CB", "1");[m +[32m+[m[32m gtkTreeExpandItem(ih, path, iupStrEqualNoCase(value, "EXPANDED"));[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_BRANCH_CB", NULL);[m +[32m+[m[32m gtk_tree_path_free(path);[m +[32m+[m[32m }[m + [m + return 0;[m + }[m +[36m@@ -1050,7 +1078,7 @@[m [mstatic char* gtkTreeGetTitleAttrib(Ihandle* ih, const char* name_id)[m + {[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return NULL;[m + return gtkTreeGetTitle(model, iterItem);[m + }[m +[36m@@ -1059,8 +1087,10 @@[m [mstatic int gtkTreeSetTitleAttrib(Ihandle* ih, const char* name_id, const char* v[m + {[m + GtkTreeStore* store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle)));[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, GTK_TREE_MODEL(store), name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m +[32m+[m[32m if (!value)[m +[32m+[m[32m value = "";[m + gtk_tree_store_set(store, &iterItem, IUPGTK_TREE_TITLE, iupgtkStrConvertToUTF8(value), -1);[m + return 0;[m + }[m +[36m@@ -1070,7 +1100,7 @@[m [mstatic int gtkTreeSetTitleFontAttrib(Ihandle* ih, const char* name_id, const cha[m + PangoFontDescription* fontdesc = NULL;[m + GtkTreeStore* store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle)));[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, GTK_TREE_MODEL(store), name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + if (value)[m + fontdesc = iupgtkGetPangoFontDesc(value);[m +[36m@@ -1083,49 +1113,12 @@[m [mstatic char* gtkTreeGetTitleFontAttrib(Ihandle* ih, const char* name_id)[m + PangoFontDescription* fontdesc;[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return NULL;[m + gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_FONT, &fontdesc, -1);[m + return pango_font_description_to_string(fontdesc);[m + }[m + [m +[31m-static char* gtkTreeGetFindUserDataAttrib(Ihandle* ih, const char* name_id)[m +[31m-{[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- int id;[m +[31m- char* str = (char*)(name_id+1); /* skip ':' */[m +[31m- void* userdata = NULL;[m +[31m- if (sscanf(str, "%p", &userdata)!=1)[m +[31m- return NULL;[m +[31m- id = gtkTreeGetUserDataId(ih, model, userdata);[m +[31m- if (id == -1)[m +[31m- return NULL;[m +[31m- str = iupStrGetMemory(16);[m +[31m- sprintf(str, "%d", id);[m +[31m- return str;[m +[31m-}[m +[31m-[m +[31m-static char* gtkTreeGetUserDataAttrib(Ihandle* ih, const char* name_id)[m +[31m-{[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- GtkTreeIter iterItem;[m +[31m- char* userdata;[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[31m- return NULL;[m +[31m- gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_USERDATA, &userdata, -1);[m +[31m- return userdata;[m +[31m-}[m +[31m-[m +[31m-static int gtkTreeSetUserDataAttrib(Ihandle* ih, const char* name_id, const char* value)[m +[31m-{[m +[31m- GtkTreeStore* store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle)));[m +[31m- GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, GTK_TREE_MODEL(store), name_id, &iterItem))[m +[31m- return 0;[m +[31m- gtk_tree_store_set(store, &iterItem, IUPGTK_TREE_USERDATA, value, -1);[m +[31m- return 0;[m +[31m-}[m +[31m-[m + static char* gtkTreeGetValueAttrib(Ihandle* ih)[m + {[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[36m@@ -1140,67 +1133,117 @@[m [mstatic char* gtkTreeGetValueAttrib(Ihandle* ih)[m + gtk_tree_path_free(path);[m + [m + str = iupStrGetMemory(16);[m +[31m- sprintf(str, "%d", gtkTreeGetNodeId(ih, iterItem));[m +[32m+[m[32m sprintf(str, "%d", gtkTreeFindNodeId(ih, &iterItem));[m + return str;[m + }[m + [m +[31m- return "0"; /* default VALUE is root */[m +[32m+[m[32m if (ih->data->node_count)[m +[32m+[m[32m return "0"; /* default VALUE is root */[m +[32m+[m[32m else[m +[32m+[m[32m return "-1";[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic char* gtkTreeGetMarkedNodesAttrib(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m char* str = iupStrGetMemory(ih->data->node_count+1);[m +[32m+[m[32m GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m GtkTreeIter iterItem;[m +[32m+[m[32m int i;[m +[32m+[m +[32m+[m[32m for (i=0; i<ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m if (gtkTreeIsNodeSelected(model, &iterItem))[m +[32m+[m[32m str[i] = '+';[m +[32m+[m[32m else[m +[32m+[m[32m str[i] = '-';[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m str[ih->data->node_count] = 0;[m +[32m+[m[32m return str;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic int gtkTreeSetMarkedNodesAttrib(Ihandle* ih, const char* value)[m +[32m+[m[32m{[m +[32m+[m[32m int count, i;[m +[32m+[m[32m GtkTreeModel* model;[m +[32m+[m[32m GtkTreeIter iterItem;[m +[32m+[m[32m GtkTreeSelection* selection;[m +[32m+[m +[32m+[m[32m if (ih->data->mark_mode==ITREE_MARK_SINGLE || !value)[m +[32m+[m[32m return 0;[m +[32m+[m +[32m+[m[32m count = strlen(value);[m +[32m+[m[32m if (count > ih->data->node_count)[m +[32m+[m[32m count = ih->data->node_count;[m +[32m+[m +[32m+[m[32m selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m +[32m+[m[32m for (i=0; i<count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m if (value[i] == '+')[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterItem, 1);[m +[32m+[m[32m else[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterItem, 0);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m +[32m+[m +[32m+[m[32m return 0;[m + }[m + [m + static int gtkTreeSetMarkAttrib(Ihandle* ih, const char* value)[m + {[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));[m +[31m- GtkTreeIter iterRoot;[m + [m + if (ih->data->mark_mode==ITREE_MARK_SINGLE)[m + return 0;[m + [m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[31m-[m + if(iupStrEqualNoCase(value, "BLOCK"))[m + {[m +[32m+[m[32m GtkTreeIter iterItem1, iterItem2;[m + GtkTreePath* pathFocus;[m + gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &pathFocus, NULL);[m +[31m- gtk_tree_selection_select_range(selection, (GtkTreePath*)iupAttribGet(ih, "_IUPTREE_MARKSTART_NODE"), pathFocus);[m +[32m+[m[32m gtk_tree_model_get_iter(model, &iterItem1, pathFocus);[m + gtk_tree_path_free(pathFocus);[m +[32m+[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem2, iupAttribGet(ih, "_IUPTREE_MARKSTART_NODE"));[m +[32m+[m +[32m+[m[32m gtkTreeSelectRange(ih, model, selection, &iterItem1, &iterItem2, 0);[m + }[m + else if(iupStrEqualNoCase(value, "CLEARALL"))[m +[31m- gtk_tree_selection_unselect_all(selection);[m +[32m+[m[32m gtkTreeSelectAll(ih, model, selection, 0);[m + else if(iupStrEqualNoCase(value, "MARKALL"))[m +[31m- gtk_tree_selection_select_all(selection);[m +[32m+[m[32m gtkTreeSelectAll(ih, model, selection, 1);[m + else if(iupStrEqualNoCase(value, "INVERTALL")) /* INVERTALL *MUST* appear before INVERT, or else INVERTALL will never be called. */[m +[31m- gtkTreeInvertAllNodeMarking(ih, model, selection, &iterRoot);[m +[32m+[m[32m gtkTreeInvertAllNodeMarking(ih, model, selection);[m + else if(iupStrEqualPartial(value, "INVERT"))[m + {[m + /* iupStrEqualPartial allows the use of "INVERTid" form */[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, &value[strlen("INVERT")], &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, &value[strlen("INVERT")], &iterItem))[m + return 0;[m + [m +[31m- if(gtk_tree_selection_iter_is_selected(selection, &iterItem))[m +[31m- gtk_tree_selection_unselect_iter(selection, &iterItem);[m +[31m- else[m +[31m- gtk_tree_selection_select_iter(selection, &iterItem);[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterItem, -1); /* toggle */[m + }[m + else[m + {[m +[31m- GtkTreePath *path1, *path2;[m + GtkTreeIter iterItem1, iterItem2;[m + char str1[50], str2[50];[m + if (iupStrToStrStr(value, str1, str2, '-')!=2)[m + return 0;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, str1, &iterItem1))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, str1, &iterItem1))[m + return 0;[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, str2, &iterItem2))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, str2, &iterItem2))[m + return 0;[m + [m +[31m- path1 = gtk_tree_model_get_path(model, &iterItem1);[m +[31m- path2 = gtk_tree_model_get_path(model, &iterItem2);[m +[31m- gtk_tree_selection_select_range(selection, path1, path2);[m +[31m- gtk_tree_path_free(path1);[m +[31m- gtk_tree_path_free(path2);[m +[32m+[m[32m gtkTreeSelectRange(ih, model, selection, &iterItem1, &iterItem2, 0);[m + }[m + [m + return 1;[m +[36m@@ -1210,148 +1253,112 @@[m [mstatic int gtkTreeSetValueAttrib(Ihandle* ih, const char* value)[m + {[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));[m +[31m- GtkTreeIter iterRoot, iterItem;[m +[32m+[m[32m GtkTreeIter iterItem;[m + GtkTreePath* path;[m +[32m+[m[32m int kind;[m + [m + if (gtkTreeSetMarkAttrib(ih, value))[m + return 0;[m + [m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[31m-[m +[31m- if (iupStrEqualNoCase(value, "ROOT"))[m +[31m- iterItem = iterRoot;[m +[32m+[m[32m if (iupStrEqualNoCase(value, "ROOT") || iupStrEqualNoCase(value, "FIRST"))[m +[32m+[m[32m gtk_tree_model_get_iter_first(model, &iterItem);[m + else if(iupStrEqualNoCase(value, "LAST"))[m +[31m- iterItem = gtkTreeGetLastVisibleNode(ih, model, iterRoot);[m +[32m+[m[32m gtkTreeGetLastVisibleNode(ih, model, &iterItem);[m + else if(iupStrEqualNoCase(value, "PGUP"))[m + {[m +[31m- GtkTreeIter iterPrev;[m +[31m-[m + GtkTreePath* pathFocus;[m + gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &pathFocus, NULL);[m +[31m- gtk_tree_model_get_iter(model, &iterPrev, pathFocus);[m +[32m+[m[32m gtk_tree_model_get_iter(model, &iterItem, pathFocus);[m + gtk_tree_path_free(pathFocus);[m + [m +[31m- ih->data->id_control = -1;[m +[31m- gtkTreeFindVisibleNodeId(ih, model, iterRoot, iterPrev);[m +[31m- ih->data->id_control -= 10; /* less 10 visible nodes */[m +[31m-[m +[31m- if(ih->data->id_control < 0)[m +[31m- ih->data->id_control = 0; /* Begin of tree = Root id */[m +[31m-[m +[31m- iterItem = gtkTreeFindVisibleNodeFromId(ih, model, iterRoot);[m +[32m+[m[32m gtkTreeGetPreviousVisibleNode(ih, model, &iterItem, 10);[m + }[m + else if(iupStrEqualNoCase(value, "PGDN"))[m + {[m +[31m- GtkTreeIter iterNext;[m +[31m-[m + GtkTreePath* pathFocus;[m + gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &pathFocus, NULL);[m +[31m- gtk_tree_model_get_iter(model, &iterNext, pathFocus);[m +[32m+[m[32m gtk_tree_model_get_iter(model, &iterItem, pathFocus);[m + gtk_tree_path_free(pathFocus);[m + [m +[31m- ih->data->id_control = -1;[m +[31m- gtkTreeFindVisibleNodeId(ih, model, iterRoot, iterNext);[m +[31m- ih->data->id_control += 10; /* more 10 visible nodes */[m +[31m-[m +[31m- iterNext = gtkTreeFindVisibleNodeFromId(ih, model, iterRoot);[m +[31m-[m +[31m- if (ih->data->id_control >= 0)[m +[31m- iterNext = gtkTreeGetLastVisibleNode(ih, model, iterRoot);[m +[31m-[m +[31m- iterItem = iterNext;[m +[32m+[m[32m gtkTreeGetNextVisibleNode(ih, model, &iterItem, 10);[m + }[m + else if(iupStrEqualNoCase(value, "NEXT"))[m + {[m +[31m- GtkTreeIter iterNext;[m +[31m-[m + GtkTreePath* pathFocus;[m + gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &pathFocus, NULL);[m +[31m- gtk_tree_model_get_iter(model, &iterNext, pathFocus);[m +[32m+[m[32m gtk_tree_model_get_iter(model, &iterItem, pathFocus);[m + gtk_tree_path_free(pathFocus);[m + [m +[31m- ih->data->id_control = -1;[m +[31m- gtkTreeFindVisibleNodeId(ih, model, iterRoot, iterNext);[m +[31m- ih->data->id_control++; /* more 1 visible node */[m +[31m-[m +[31m- iterNext = gtkTreeFindVisibleNodeFromId(ih, model, iterRoot);[m +[31m-[m +[31m- if (ih->data->id_control >= 0)[m +[31m- iterNext = gtkTreeGetLastVisibleNode(ih, model, iterRoot);[m +[31m-[m +[31m- iterItem = iterNext;[m +[32m+[m[32m gtkTreeGetNextVisibleNode(ih, model, &iterItem, 1);[m + }[m + else if(iupStrEqualNoCase(value, "PREVIOUS"))[m + {[m +[31m- GtkTreeIter iterPrev;[m +[31m-[m + GtkTreePath* pathFocus;[m + gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &pathFocus, NULL);[m +[31m- gtk_tree_model_get_iter(model, &iterPrev, pathFocus);[m +[32m+[m[32m gtk_tree_model_get_iter(model, &iterItem, pathFocus);[m + gtk_tree_path_free(pathFocus);[m + [m +[31m- ih->data->id_control = -1;[m +[31m- gtkTreeFindVisibleNodeId(ih, model, iterRoot, iterPrev);[m +[31m- ih->data->id_control--; /* less 1 visible node */[m +[31m-[m +[31m- if (ih->data->id_control < 0)[m +[31m- ih->data->id_control = 0;[m +[31m-[m +[31m- iterItem = gtkTreeFindVisibleNodeFromId(ih, model, iterRoot);[m +[31m- if (!iterItem.user_data)[m +[31m- return 0;[m +[32m+[m[32m gtkTreeGetPreviousVisibleNode(ih, model, &iterItem, 1);[m + }[m + else[m + {[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, value, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, value, &iterItem))[m + return 0;[m + }[m + [m + /* select */[m + if (ih->data->mark_mode==ITREE_MARK_SINGLE)[m + {[m +[31m- iupAttribSetStr(ih, "_IUP_IGNORE_SELECTION", "1");[m +[31m- gtk_tree_selection_select_iter(selection, &iterItem);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterItem, 1);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + }[m + [m + path = gtk_tree_model_get_path(model, &iterItem);[m +[32m+[m +[32m+[m[32m /* make it visible */[m +[32m+[m[32m gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_KIND, &kind, -1);[m +[32m+[m[32m if (kind == ITREE_LEAF)[m +[32m+[m[32m gtk_tree_view_expand_to_path(GTK_TREE_VIEW(ih->handle), path);[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m int expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(ih->handle), path);[m +[32m+[m[32m gtk_tree_view_expand_to_path(GTK_TREE_VIEW(ih->handle), path);[m +[32m+[m[32m if (!expanded) gtk_tree_view_collapse_row(GTK_TREE_VIEW(ih->handle), path);[m +[32m+[m[32m }[m +[32m+[m + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ih->handle), path, NULL, FALSE, 0, 0); /* scroll to visible */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m + gtk_tree_view_set_cursor(GTK_TREE_VIEW(ih->handle), path, NULL, FALSE); /* set focus */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m +[32m+[m + gtk_tree_path_free(path);[m + [m +[31m- iupAttribSetInt(ih, "_IUPTREE_OLDVALUE", gtkTreeGetNodeId(ih, iterItem));[m +[32m+[m[32m iupAttribSetInt(ih, "_IUPTREE_OLDVALUE", gtkTreeFindNodeId(ih, &iterItem));[m + [m + return 0;[m + } [m + [m + static int gtkTreeSetMarkStartAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- GtkTreePath *pathMarkStart, *pathMarkStartPrev;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + [m +[31m- pathMarkStart = gtk_tree_model_get_path(model, &iterItem);[m +[31m-[m +[31m- pathMarkStartPrev = (GtkTreePath*)iupAttribGet(ih, "_IUPTREE_MARKSTART_NODE");[m +[31m- if (pathMarkStartPrev)[m +[31m- gtk_tree_path_free(pathMarkStartPrev);[m +[31m-[m +[31m- iupAttribSetStr(ih, "_IUPTREE_MARKSTART_NODE", (char*)pathMarkStart);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_MARKSTART_NODE", (char*)iterItem.user_data);[m + [m + return 1;[m + }[m + [m + static char* gtkTreeGetMarkedAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- GtkTreeSelection* selection;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m GtkTreeModel* model;[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + [m +[31m- selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));[m +[31m- if (gtk_tree_selection_iter_is_selected(selection, &iterItem))[m +[32m+[m[32m model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m if (gtkTreeIsNodeSelected(model, &iterItem))[m + return "YES";[m + else[m + return "NO";[m +[36m@@ -1359,87 +1366,99 @@[m [mstatic char* gtkTreeGetMarkedAttrib(Ihandle* ih, const char* name_id)[m + [m + static int gtkTreeSetMarkedAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[32m+[m[32m GtkTreeModel* model;[m + GtkTreeSelection* selection;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + [m +[31m- iupAttribSetStr(ih, "_IUP_IGNORE_SELECTION", "1");[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m + [m + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + if (iupStrBoolean(value))[m +[31m- gtk_tree_selection_select_iter(selection, &iterItem);[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterItem, 1);[m + else[m +[31m- gtk_tree_selection_unselect_iter(selection, &iterItem);[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterItem, 0);[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + [m + return 0;[m + }[m + [m + static int gtkTreeSetDelNodeAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m +[31m- if (iupStrEqualNoCase(value, "SELECTED")) /* selected here means the specified one */[m +[32m+[m[32m if (iupStrEqualNoCase(value, "ALL"))[m + {[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- GtkTreeIter iterItem;[m +[31m- GtkTreeIter iterParent;[m +[32m+[m[32m gtkTreeCallNodeRemovedAll(ih);[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[31m- return 0;[m +[32m+[m[32m /* deleting the reference node (and it's children) */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m[32m gtk_tree_store_clear(GTK_TREE_STORE(model));[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m[32m if (iupStrEqualNoCase(value, "SELECTED")) /* selected here means the reference node */[m +[32m+[m[32m {[m +[32m+[m[32m GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m GtkTreeIter iterItem;[m + [m +[31m- if (!gtk_tree_model_iter_parent(model, &iterParent, &iterItem)) /* the root node can't be deleted */[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + [m + gtkTreeCallNodeRemoved(ih, model, &iterItem);[m + [m +[31m- /* deleting the specified node (and it's children) */[m +[32m+[m[32m /* deleting the reference node (and it's children) */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m + gtk_tree_store_remove(GTK_TREE_STORE(model), &iterItem);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + }[m +[31m- else if(iupStrEqualNoCase(value, "CHILDREN")) /* children of the specified one */[m +[32m+[m[32m else if(iupStrEqualNoCase(value, "CHILDREN")) /* children of the reference node */[m + {[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + GtkTreeIter iterItem, iterChild;[m + int hasChildren;[m + [m +[31m- if (!gtkTreeFindNodeFromString(ih, model, name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + [m + hasChildren = gtk_tree_model_iter_children(model, &iterChild, &iterItem);[m + [m +[31m- /* deleting the selected node's children */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m +[32m+[m[32m /* deleting the reference node children */[m + while(hasChildren)[m + {[m + gtkTreeCallNodeRemoved(ih, model, &iterChild);[m + hasChildren = gtk_tree_store_remove(GTK_TREE_STORE(model), &iterChild);[m + }[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + }[m + else if(iupStrEqualNoCase(value, "MARKED")) /* Delete the array of marked nodes */[m + {[m +[32m+[m[32m int i;[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));[m +[31m- GList *rr_list = NULL;[m +[31m- GList *node;[m +[32m+[m[32m GtkTreeIter iterItem;[m + [m +[31m- gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)gtkTreeSelected_Iter_Func, &rr_list);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m + [m +[31m- for(node = rr_list; node != NULL; node = node->next)[m +[32m+[m[32m for(i = 1; i < ih->data->node_count; /* increment only if not removed */)[m + {[m +[31m- GtkTreePath* path = gtk_tree_row_reference_get_path(node->data);[m +[31m- if (path)[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m if (gtkTreeIsNodeSelected(model, &iterItem))[m + {[m +[31m- GtkTreeIter iterItem;[m +[31m- if (gtk_tree_model_get_iter(model, &iterItem, path))[m +[31m- {[m +[31m- gtkTreeCallNodeRemoved(ih, model, &iterItem);[m +[31m- gtk_tree_store_remove(GTK_TREE_STORE(model), &iterItem);[m +[31m- }[m +[31m- gtk_tree_path_free(path);[m +[32m+[m[32m gtkTreeCallNodeRemoved(ih, model, &iterItem);[m +[32m+[m[32m gtk_tree_store_remove(GTK_TREE_STORE(model), &iterItem);[m + }[m +[31m- gtk_tree_row_reference_free(node->data);[m +[32m+[m[32m else[m +[32m+[m[32m i++;[m + }[m +[31m- g_list_free(rr_list);[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + }[m + [m + return 0;[m +[36m@@ -1450,36 +1469,11 @@[m [mstatic int gtkTreeSetRenameAttrib(Ihandle* ih, const char* value)[m + if (ih->data->show_rename)[m + {[m + GtkTreePath* path;[m +[31m- IFni cbShowRename = (IFni)IupGetCallback(ih, "SHOWRENAME_CB");[m + GtkTreeViewColumn *focus_column;[m +[31m-[m + gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &path, &focus_column);[m +[31m-[m +[31m- if (cbShowRename)[m +[31m- {[m +[31m- GtkTreeIter iterItem;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- gtk_tree_model_get_iter(model, &iterItem, path);[m +[31m- cbShowRename(ih, gtkTreeGetNodeId(ih, iterItem));[m +[31m- }[m +[31m-[m + gtk_tree_view_set_cursor(GTK_TREE_VIEW(ih->handle), path, focus_column, TRUE);[m + gtk_tree_path_free(path);[m + }[m +[31m- else[m +[31m- {[m +[31m- IFnis cbRenameNode = (IFnis)IupGetCallback(ih, "RENAMENODE_CB");[m +[31m- if (cbRenameNode)[m +[31m- {[m +[31m- GtkTreePath* path;[m +[31m- GtkTreeIter iterItem;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &path, NULL);[m +[31m- gtk_tree_model_get_iter(model, &iterItem, path);[m +[31m- gtk_tree_path_free(path);[m +[31m- cbRenameNode(ih, gtkTreeGetNodeId(ih, iterItem), gtkTreeGetTitle(model, iterItem)); [m +[31m- }[m +[31m- }[m + [m + (void)value;[m + return 0;[m +[36m@@ -1491,7 +1485,7 @@[m [mstatic int gtkTreeSetImageExpandedAttrib(Ihandle* ih, const char* name_id, const[m + GtkTreeStore* store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle)));[m + GdkPixbuf* pixExpand = iupImageGetImage(value, ih, 0);[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, GTK_TREE_MODEL(store), name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + [m + gtk_tree_model_get(GTK_TREE_MODEL(store), &iterItem, IUPGTK_TREE_KIND, &kind, -1);[m +[36m@@ -1514,7 +1508,7 @@[m [mstatic int gtkTreeSetImageAttrib(Ihandle* ih, const char* name_id, const char* v[m + GtkTreeStore* store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle)));[m + GdkPixbuf* pixImage = iupImageGetImage(value, ih, 0);[m + GtkTreeIter iterItem;[m +[31m- if (!gtkTreeFindNodeFromString(ih, GTK_TREE_MODEL(store), name_id, &iterItem))[m +[32m+[m[32m if (!gtkTreeFindNodeFromString(ih, name_id, &iterItem))[m + return 0;[m + [m + if (pixImage)[m +[36m@@ -1539,42 +1533,30 @@[m [mstatic int gtkTreeSetImageAttrib(Ihandle* ih, const char* name_id, const char* v[m + [m + static int gtkTreeSetImageBranchExpandedAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- GtkTreeIter iterRoot;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + ih->data->def_image_expanded = iupImageGetImage(value, ih, 0);[m + [m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[31m-[m +[31m- /* Update all images, starting at root node */[m +[31m- gtkTreeUpdateImages(ih, model, iterRoot, ITREE_UPDATEIMAGE_EXPANDED);[m +[32m+[m[32m /* Update all images */[m +[32m+[m[32m gtkTreeUpdateImages(ih, ITREE_UPDATEIMAGE_EXPANDED);[m + [m + return 1;[m + }[m + [m + static int gtkTreeSetImageBranchCollapsedAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- GtkTreeIter iterRoot;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + ih->data->def_image_collapsed = iupImageGetImage(value, ih, 0);[m + [m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[31m-[m +[31m- /* Update all images, starting at root node */[m +[31m- gtkTreeUpdateImages(ih, model, iterRoot, ITREE_UPDATEIMAGE_COLLAPSED);[m +[32m+[m[32m /* Update all images */[m +[32m+[m[32m gtkTreeUpdateImages(ih, ITREE_UPDATEIMAGE_COLLAPSED);[m + [m + return 1;[m + }[m + [m + static int gtkTreeSetImageLeafAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- GtkTreeIter iterRoot;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + ih->data->def_image_leaf = iupImageGetImage(value, ih, 0);[m + [m +[31m- gtk_tree_model_get_iter_first(model, &iterRoot);[m +[31m-[m +[31m- /* Update all images, starting at root node */[m +[31m- gtkTreeUpdateImages(ih, model, iterRoot, ITREE_UPDATEIMAGE_LEAF);[m +[32m+[m[32m /* Update all images */[m +[32m+[m[32m gtkTreeUpdateImages(ih, ITREE_UPDATEIMAGE_LEAF);[m + [m + return 1;[m + }[m +[36m@@ -1655,6 +1637,7 @@[m [mvoid iupdrvTreeUpdateMarkMode(Ihandle *ih)[m + if (ih->data->mark_mode==ITREE_MARK_MULTIPLE && !ih->data->show_dragdrop)[m + {[m + #if GTK_CHECK_VERSION(2, 10, 0)[m +[32m+[m[32m if (iupAttribGetInt(ih, "RUBBERBAND"))[m + gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(ih->handle), TRUE);[m + #endif[m + }[m +[36m@@ -1704,6 +1687,19 @@[m [mstatic void gtkTreeCellTextEditingStarted(GtkCellRenderer *cell, GtkCellEditable[m + PangoFontDescription* fontdesc = NULL;[m + GdkColor *color = NULL;[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m[32m IFni cbShowRename;[m +[32m+[m +[32m+[m[32m gtk_tree_model_get_iter_from_string(model, &iterItem, path_string);[m +[32m+[m +[32m+[m[32m cbShowRename = (IFni)IupGetCallback(ih, "SHOWRENAME_CB");[m +[32m+[m[32m if (cbShowRename && cbShowRename(ih, gtkTreeFindNodeId(ih, &iterItem))==IUP_IGNORE)[m +[32m+[m[32m {[m +[32m+[m[32m /* TODO: non of these worked:[m +[32m+[m[32m gtk_cell_renderer_stop_editing(cell, TRUE);[m +[32m+[m[32m gtk_cell_editable_editing_done(editable); */[m +[32m+[m[32m gtk_editable_set_editable(GTK_EDITABLE(editable), FALSE);[m +[32m+[m[32m return;[m +[32m+[m[32m }[m + [m + value = iupAttribGetStr(ih, "RENAMECARET");[m + if (value)[m +[36m@@ -1713,7 +1709,6 @@[m [mstatic void gtkTreeCellTextEditingStarted(GtkCellRenderer *cell, GtkCellEditable[m + if (value)[m + gtkTreeSetRenameSelectionPos(editable, value);[m + [m +[31m- gtk_tree_model_get_iter_from_string(model, &iterItem, path_string);[m + gtk_tree_model_get(model, &iterItem, IUPGTK_TREE_FONT, &fontdesc, -1);[m + if (fontdesc)[m + gtk_widget_modify_font(GTK_WIDGET(editable), fontdesc);[m +[36m@@ -1732,7 +1727,7 @@[m [mstatic void gtkTreeCellTextEdited(GtkCellRendererText *cell, gchar *path_string,[m + IFnis cbRename;[m + [m + if (!new_text)[m +[31m- return;[m +[32m+[m[32m new_text = "";[m + [m + model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + if (!gtk_tree_model_get_iter_from_string(model, &iterItem, path_string))[m +[36m@@ -1741,7 +1736,7 @@[m [mstatic void gtkTreeCellTextEdited(GtkCellRendererText *cell, gchar *path_string,[m + cbRename = (IFnis)IupGetCallback(ih, "RENAME_CB");[m + if (cbRename)[m + {[m +[31m- if (cbRename(ih, gtkTreeGetNodeId(ih, iterItem), iupgtkStrConvertFromUTF8(new_text)) == IUP_IGNORE)[m +[32m+[m[32m if (cbRename(ih, gtkTreeFindNodeId(ih, &iterItem), iupgtkStrConvertFromUTF8(new_text)) == IUP_IGNORE)[m + return;[m + }[m + [m +[36m@@ -1766,8 +1761,8 @@[m [mstatic int gtkTreeCallDragDropCb(Ihandle* ih, GtkTreeIter *iterDrag, GtkTreeIter[m + [m + if (cbDragDrop)[m + {[m +[31m- int drag_id = gtkTreeGetNodeId(ih, *iterDrag);[m +[31m- int drop_id = gtkTreeGetNodeId(ih, *iterDrop);[m +[32m+[m[32m int drag_id = gtkTreeFindNodeId(ih, iterDrag);[m +[32m+[m[32m int drop_id = gtkTreeFindNodeId(ih, iterDrop);[m + return cbDragDrop(ih, drag_id, drop_id, is_shift, *is_ctrl);[m + }[m + [m +[36m@@ -1804,22 +1799,17 @@[m [mstatic void gtkTreeDragDataReceived(GtkWidget *widget, GdkDragContext *context,[m + {[m + GtkTreeIter iterNewItem;[m + [m +[31m- /* Copy the dragged item to the new position. */[m +[31m- gtkTreeCopyNode(ih, model, &iterDrag, &iterDrop, &iterNewItem, is_ctrl);[m +[31m-[m +[31m- if (!is_ctrl)[m +[31m- {[m +[31m- /* do not delete the user data, we copy the references in CopyNode */[m +[31m- gtk_tree_store_remove(GTK_TREE_STORE(model), &iterDrag);[m +[31m- }[m +[32m+[m[32m /* Copy or move the dragged item to the new position. */[m +[32m+[m[32m gtkTreeCopyMoveNode(ih, model, &iterDrag, &iterDrop, &iterNewItem, is_ctrl);[m + [m + /* set focus and selection */[m +[32m+[m[32m if (iterNewItem.stamp)[m + {[m + GtkTreePath *pathNew;[m + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));[m + [m + pathNew = gtk_tree_model_get_path(model, &iterNewItem);[m +[31m- gtk_tree_selection_select_path(selection, pathNew);[m +[32m+[m[32m gtkTreeSelectNode(model, selection, &iterNewItem, 1);[m + [m + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(ih->handle), pathNew, NULL, FALSE, 0, 0);[m + gtk_tree_view_set_cursor(GTK_TREE_VIEW(ih->handle), pathNew, NULL, FALSE);[m +[36m@@ -1927,10 +1917,24 @@[m [mstatic void gtkTreeDragBegin(GtkWidget *widget, GdkDragContext *context, Ihandle[m + (void)widget;[m + }[m + [m +[32m+[m[32mstatic gboolean gtkTreeSelectionFunc(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean selected, Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m GtkTreeIter iterItem;[m +[32m+[m[32m gtk_tree_model_get_iter(model, &iterItem, path);[m +[32m+[m[32m gtkTreeSelectNodeRaw(model, &iterItem, !selected);[m +[32m+[m[32m (void)ih;[m +[32m+[m[32m (void)selection;[m +[32m+[m[32m return TRUE;[m +[32m+[m[32m}[m +[32m+[m + static void gtkTreeSelectionChanged(GtkTreeSelection* selection, Ihandle* ih)[m + {[m + IFnii cbSelec;[m + int is_ctrl = 0;[m +[32m+[m[32m (void)selection;[m +[32m+[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPTREE_IGNORE_SELECTION_CB"))[m +[32m+[m[32m return;[m + [m + if (ih->data->mark_mode == ITREE_MARK_MULTIPLE)[m + {[m +[36m@@ -1953,25 +1957,17 @@[m [mstatic void gtkTreeSelectionChanged(GtkTreeSelection* selection, Ihandle* ih)[m + if (cbSelec)[m + {[m + int curpos = -1, is_selected = 0;[m +[32m+[m[32m GtkTreeIter iterFocus;[m +[32m+[m[32m GtkTreePath* pathFocus;[m +[32m+[m[32m GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + [m +[31m- if (iupAttribGet(ih, "_IUP_IGNORE_SELECTION"))[m +[31m- {[m +[31m- iupAttribSetStr(ih, "_IUP_IGNORE_SELECTION", NULL);[m +[31m- return;[m +[31m- }[m +[31m-[m +[32m+[m[32m gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &pathFocus, NULL);[m +[32m+[m[32m if (pathFocus)[m + {[m +[31m- GtkTreeIter iterFocus;[m +[31m- GtkTreePath* pathFocus;[m +[31m- GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[31m- gtk_tree_view_get_cursor(GTK_TREE_VIEW(ih->handle), &pathFocus, NULL);[m +[31m- if (pathFocus)[m +[31m- {[m +[31m- gtk_tree_model_get_iter(model, &iterFocus, pathFocus);[m +[31m- gtk_tree_path_free(pathFocus);[m +[31m- curpos = gtkTreeGetNodeId(ih, iterFocus);[m +[31m- is_selected = gtk_tree_selection_iter_is_selected(selection, &iterFocus);[m +[31m- }[m +[32m+[m[32m gtk_tree_model_get_iter(model, &iterFocus, pathFocus);[m +[32m+[m[32m gtk_tree_path_free(pathFocus);[m +[32m+[m[32m curpos = gtkTreeFindNodeId(ih, &iterFocus);[m +[32m+[m[32m is_selected = gtkTreeIsNodeSelected(model, &iterFocus);[m + }[m + [m + if (curpos == -1)[m +[36m@@ -1993,18 +1989,52 @@[m [mstatic void gtkTreeSelectionChanged(GtkTreeSelection* selection, Ihandle* ih)[m + }[m + }[m + [m +[32m+[m[32mstatic void gtkTreeUpdateSelectionChildren(Ihandle* ih, GtkTreeModel* model, GtkTreeSelection* selection, GtkTreeIter *iterItem)[m +[32m+[m[32m{[m +[32m+[m[32m int expanded;[m +[32m+[m[32m GtkTreeIter iterChild;[m +[32m+[m[32m int hasItem = gtk_tree_model_iter_children(model, &iterChild, iterItem); /* get the firstchild */[m +[32m+[m[32m while(hasItem)[m +[32m+[m[32m {[m +[32m+[m[32m if (gtkTreeIsNodeSelected(model, &iterChild))[m +[32m+[m[32m gtk_tree_selection_select_iter(selection, &iterChild);[m +[32m+[m +[32m+[m[32m expanded = 0;[m +[32m+[m[32m if (gtk_tree_model_iter_has_child(model, &iterChild))[m +[32m+[m[32m {[m +[32m+[m[32m GtkTreePath* path = gtk_tree_model_get_path(model, &iterChild);[m +[32m+[m[32m expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(ih->handle), path);[m +[32m+[m[32m gtk_tree_path_free(path);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m /* Recursive only if expanded */[m +[32m+[m[32m if (expanded)[m +[32m+[m[32m gtkTreeUpdateSelectionChildren(ih, model, selection, &iterChild);[m[41m [m +[32m+[m +[32m+[m[32m /* Go to next sibling item */[m +[32m+[m[32m hasItem = gtk_tree_model_iter_next(model, &iterChild);[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void gtkTreeRowExpanded(GtkTreeView* tree_view, GtkTreeIter *iterItem, GtkTreePath *path, Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m GtkTreeSelection* selection = gtk_tree_view_get_selection(tree_view);[m +[32m+[m[32m GtkTreeModel* model = gtk_tree_view_get_model(tree_view);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m[32m gtkTreeUpdateSelectionChildren(ih, model, selection, iterItem);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m +[32m+[m[32m (void)path;[m +[32m+[m[32m}[m +[32m+[m + static gboolean gtkTreeTestExpandRow(GtkTreeView* tree_view, GtkTreeIter *iterItem, GtkTreePath *path, Ihandle* ih)[m + {[m + IFni cbBranchOpen = (IFni)IupGetCallback(ih, "BRANCHOPEN_CB");[m + if (cbBranchOpen)[m + {[m +[31m- if (iupAttribGet(ih, "_IUPTREE_IGNORE_BRANCHOPEN_CB"))[m +[31m- {[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_BRANCHOPEN_CB", NULL);[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPTREE_IGNORE_BRANCH_CB"))[m + return FALSE;[m +[31m- }[m + [m +[31m- if (cbBranchOpen(ih, gtkTreeGetNodeId(ih, *iterItem)) == IUP_IGNORE)[m +[32m+[m[32m if (cbBranchOpen(ih, gtkTreeFindNodeId(ih, iterItem)) == IUP_IGNORE)[m + return TRUE; /* prevent the change */[m + }[m + [m +[36m@@ -2018,7 +2048,10 @@[m [mstatic gboolean gtkTreeTestCollapseRow(GtkTreeView* tree_view, GtkTreeIter *iter[m + IFni cbBranchClose = (IFni)IupGetCallback(ih, "BRANCHCLOSE_CB");[m + if (cbBranchClose)[m + {[m +[31m- if (cbBranchClose(ih, gtkTreeGetNodeId(ih, *iterItem)) == IUP_IGNORE)[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPTREE_IGNORE_BRANCH_CB"))[m +[32m+[m[32m return FALSE;[m +[32m+[m +[32m+[m[32m if (cbBranchClose(ih, gtkTreeFindNodeId(ih, iterItem)) == IUP_IGNORE)[m + return TRUE;[m + }[m + [m +[36m@@ -2042,7 +2075,7 @@[m [mstatic void gtkTreeRowActived(GtkTreeView* tree_view, GtkTreePath *path, GtkTree[m + [m + /* just to leaf nodes */[m + if(gtk_tree_model_iter_has_child(model, &iterItem) == 0 && kind == ITREE_LEAF)[m +[31m- cbExecuteLeaf(ih, gtkTreeGetNodeId(ih, iterItem));[m +[32m+[m[32m cbExecuteLeaf(ih, gtkTreeFindNodeId(ih, &iterItem));[m + [m + (void)column;[m + (void)tree_view;[m +[36m@@ -2057,11 +2090,57 @@[m [mstatic int gtkTreeConvertXYToPos(Ihandle* ih, int x, int y)[m + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m + gtk_tree_model_get_iter(model, &iterItem, path);[m + gtk_tree_path_free (path);[m +[31m- return gtkTreeGetNodeId(ih, iterItem);[m +[32m+[m[32m return gtkTreeFindNodeId(ih, &iterItem);[m + }[m + return -1;[m + }[m + [m +[32m+[m[32mstatic Iarray* gtkTreeGetSelectedArrayId(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m Iarray* selarray = iupArrayCreate(1, sizeof(int));[m +[32m+[m[32m int i;[m +[32m+[m[32m GtkTreeIter iterItem;[m +[32m+[m[32m GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle));[m +[32m+[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle);[m +[32m+[m[32m if (gtkTreeIsNodeSelected(model, &iterItem))[m +[32m+[m[32m {[m +[32m+[m[32m int* id_hitem = (int*)iupArrayInc(selarray);[m +[32m+[m[32m int j = iupArrayCount(selarray);[m +[32m+[m[32m id_hitem[j-1] = i;[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m return selarray;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void gtkTreeCallMultiUnSelectionCb(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m IFnIi cbMulti = (IFnIi)IupGetCallback(ih, "MULTIUNSELECTION_CB");[m +[32m+[m[32m IFnii cbSelec = (IFnii)IupGetCallback(ih, "SELECTION_CB");[m +[32m+[m[32m if (cbSelec || cbMulti)[m +[32m+[m[32m {[m +[32m+[m[32m Iarray* markedArray = gtkTreeGetSelectedArrayId(ih);[m +[32m+[m[32m int* id_hitem = (int*)iupArrayGetData(markedArray);[m +[32m+[m[32m int i, count = iupArrayCount(markedArray);[m +[32m+[m +[32m+[m[32m if (count > 1)[m +[32m+[m[32m {[m +[32m+[m[32m if (cbMulti)[m +[32m+[m[32m cbMulti(ih, id_hitem, iupArrayCount(markedArray));[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m for (i=0; i<count; i++)[m +[32m+[m[32m cbSelec(ih, id_hitem[i], 0);[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m iupArrayDestroy(markedArray);[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m + static gboolean gtkTreeButtonEvent(GtkWidget *treeview, GdkEventButton *evt, Ihandle* ih)[m + {[m + if (iupgtkButtonEvent(treeview, evt, ih) == TRUE)[m +[36m@@ -2097,6 +2176,18 @@[m [mstatic gboolean gtkTreeButtonEvent(GtkWidget *treeview, GdkEventButton *evt, Iha[m + gtk_tree_path_free(path);[m + }[m + }[m +[32m+[m[32m else if (evt->type == GDK_BUTTON_PRESS && evt->button == 1) /* left single press */[m +[32m+[m[32m {[m +[32m+[m[32m iupAttribSetInt(ih, "_IUPTREE_DRAG_X", (int)evt->x);[m +[32m+[m[32m iupAttribSetInt(ih, "_IUPTREE_DRAG_Y", (int)evt->y);[m +[32m+[m +[32m+[m[32m if (ih->data->mark_mode==ITREE_MARK_MULTIPLE &&[m[41m [m +[32m+[m[32m !(evt->state & GDK_SHIFT_MASK) && !(evt->state & GDK_CONTROL_MASK))[m +[32m+[m[32m {[m +[32m+[m[32m gtkTreeCallMultiUnSelectionCb(ih);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_EXTENDSELECT", "1");[m +[32m+[m[32m }[m +[32m+[m[32m }[m + else if (evt->type == GDK_BUTTON_RELEASE && evt->button == 1) /* left single release */[m + {[m + if (ih->data->mark_mode==ITREE_MARK_MULTIPLE && (evt->state & GDK_SHIFT_MASK))[m +[36m@@ -2109,16 +2200,7 @@[m [mstatic gboolean gtkTreeButtonEvent(GtkWidget *treeview, GdkEventButton *evt, Iha[m + iupAttribSetStr(ih, "_IUPTREE_EXTENDSELECT", "2");[m + }[m + }[m +[31m- else if (evt->type == GDK_BUTTON_PRESS && evt->button == 1) /* left single press */[m +[31m- {[m +[31m- iupAttribSetInt(ih, "_IUPTREE_DRAG_X", (int)evt->x);[m +[31m- iupAttribSetInt(ih, "_IUPTREE_DRAG_Y", (int)evt->y);[m + [m +[31m- if (ih->data->mark_mode==ITREE_MARK_MULTIPLE && [m +[31m- !(evt->state & GDK_SHIFT_MASK) && !(evt->state & GDK_CONTROL_MASK))[m +[31m- iupAttribSetStr(ih, "_IUPTREE_EXTENDSELECT", "1");[m +[31m- }[m +[31m- [m + return FALSE;[m + }[m + [m +[36m@@ -2159,29 +2241,14 @@[m [mstatic void gtkTreeEnableDragDrop(Ihandle* ih)[m + { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }[m + };[m + [m +[31m- if (iupAttribGetBoolean(ih, "AUTODRAGDROP"))[m +[31m- {[m +[31m- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW(ih->handle),[m +[31m- GDK_BUTTON1_MASK,[m +[31m- row_targets,[m +[31m- G_N_ELEMENTS(row_targets),[m +[31m- GDK_ACTION_MOVE|GDK_ACTION_COPY);[m +[31m- gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW(ih->handle),[m +[31m- row_targets,[m +[31m- G_N_ELEMENTS(row_targets),[m +[31m- GDK_ACTION_MOVE|GDK_ACTION_COPY);[m +[31m- }[m +[31m- else[m +[31m- {[m +[31m- gtk_drag_source_set(ih->handle, GDK_BUTTON1_MASK, row_targets, G_N_ELEMENTS(row_targets), GDK_ACTION_MOVE|GDK_ACTION_COPY);[m +[31m- gtk_drag_dest_set(ih->handle, GDK_BUTTON1_MASK, row_targets, G_N_ELEMENTS(row_targets), GDK_ACTION_MOVE|GDK_ACTION_COPY);[m +[32m+[m[32m gtk_drag_source_set(ih->handle, GDK_BUTTON1_MASK, row_targets, G_N_ELEMENTS(row_targets), GDK_ACTION_MOVE|GDK_ACTION_COPY);[m +[32m+[m[32m gtk_drag_dest_set(ih->handle, GDK_BUTTON1_MASK, row_targets, G_N_ELEMENTS(row_targets), GDK_ACTION_MOVE|GDK_ACTION_COPY);[m + [m +[31m- g_signal_connect(G_OBJECT(ih->handle), "drag-begin", G_CALLBACK(gtkTreeDragBegin), ih);[m +[31m- g_signal_connect(G_OBJECT(ih->handle), "drag-motion", G_CALLBACK(gtkTreeDragMotion), ih);[m +[31m- g_signal_connect(G_OBJECT(ih->handle), "drag-leave", G_CALLBACK(gtkTreeDragLeave), NULL);[m +[31m- g_signal_connect(G_OBJECT(ih->handle), "drag-drop", G_CALLBACK(gtkTreeDragDrop), ih);[m +[31m- g_signal_connect(G_OBJECT(ih->handle), "drag-data-received", G_CALLBACK(gtkTreeDragDataReceived), ih);[m +[31m- }[m +[32m+[m[32m g_signal_connect(G_OBJECT(ih->handle), "drag-begin", G_CALLBACK(gtkTreeDragBegin), ih);[m +[32m+[m[32m g_signal_connect(G_OBJECT(ih->handle), "drag-motion", G_CALLBACK(gtkTreeDragMotion), ih);[m +[32m+[m[32m g_signal_connect(G_OBJECT(ih->handle), "drag-leave", G_CALLBACK(gtkTreeDragLeave), NULL);[m +[32m+[m[32m g_signal_connect(G_OBJECT(ih->handle), "drag-drop", G_CALLBACK(gtkTreeDragDrop), ih);[m +[32m+[m[32m g_signal_connect(G_OBJECT(ih->handle), "drag-data-received", G_CALLBACK(gtkTreeDragDataReceived), ih);[m + }[m + [m + /*****************************************************************************/[m +[36m@@ -2194,8 +2261,16 @@[m [mstatic int gtkTreeMapMethod(Ihandle* ih)[m + GtkTreeSelection* selection;[m + GtkTreeViewColumn *column;[m + [m +[31m- store = gtk_tree_store_new(9, GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN,[m +[31m- G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_COLOR, PANGO_TYPE_FONT_DESCRIPTION, G_TYPE_POINTER);[m +[32m+[m[32m store = gtk_tree_store_new(IUPGTK_TREE_LAST_DATA,[m[41m [m +[32m+[m[32m GDK_TYPE_PIXBUF, /* IUPGTK_TREE_IMAGE */[m +[32m+[m[32m G_TYPE_BOOLEAN, /* IUPGTK_TREE_HAS_IMAGE */[m +[32m+[m[32m GDK_TYPE_PIXBUF, /* IUPGTK_TREE_IMAGE_EXPANDED */[m +[32m+[m[32m G_TYPE_BOOLEAN, /* IUPGTK_TREE_HAS_IMAGE_EXPANDED */[m +[32m+[m[32m G_TYPE_STRING, /* IUPGTK_TREE_TITLE */[m +[32m+[m[32m G_TYPE_INT, /* IUPGTK_TREE_KIND */[m +[32m+[m[32m GDK_TYPE_COLOR, /* IUPGTK_TREE_COLOR */[m +[32m+[m[32m PANGO_TYPE_FONT_DESCRIPTION, /* IUPGTK_TREE_FONT */[m +[32m+[m[32m G_TYPE_BOOLEAN); /* IUPGTK_TREE_SELECT */[m + [m + ih->handle = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));[m + [m +[36m@@ -2262,8 +2337,9 @@[m [mstatic int gtkTreeMapMethod(Ihandle* ih)[m + gtk_scrolled_window_set_policy(scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);[m + [m + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));[m +[31m- [m + gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);[m +[32m+[m[32m gtk_tree_selection_set_select_function(selection, (GtkTreeSelectionFunc)gtkTreeSelectionFunc, ih, NULL);[m +[32m+[m + gtk_tree_view_set_reorderable(GTK_TREE_VIEW(ih->handle), FALSE);[m + [m + /* callbacks */[m +[36m@@ -2279,6 +2355,7 @@[m [mstatic int gtkTreeMapMethod(Ihandle* ih)[m + g_signal_connect(G_OBJECT(ih->handle), "show-help", G_CALLBACK(iupgtkShowHelp), ih);[m + g_signal_connect(G_OBJECT(ih->handle), "motion-notify-event",G_CALLBACK(iupgtkMotionNotifyEvent), ih);[m + [m +[32m+[m[32m g_signal_connect(G_OBJECT(ih->handle), "row-expanded", G_CALLBACK(gtkTreeRowExpanded), ih);[m + g_signal_connect(G_OBJECT(ih->handle), "test-expand-row", G_CALLBACK(gtkTreeTestExpandRow), ih);[m + g_signal_connect(G_OBJECT(ih->handle), "test-collapse-row", G_CALLBACK(gtkTreeTestCollapseRow), ih);[m + g_signal_connect(G_OBJECT(ih->handle), "row-activated", G_CALLBACK(gtkTreeRowActived), ih);[m +[36m@@ -2301,7 +2378,8 @@[m [mstatic int gtkTreeMapMethod(Ihandle* ih)[m + ih->data->def_image_collapsed = iupImageGetImage("IMGCOLLAPSED", ih, 0);[m + ih->data->def_image_expanded = iupImageGetImage("IMGEXPANDED", ih, 0);[m + [m +[31m- gtkTreeAddRootNode(ih);[m +[32m+[m[32m if (iupAttribGetInt(ih, "ADDROOT"))[m +[32m+[m[32m iupdrvTreeAddNode(ih, "-1", ITREE_BRANCH, "", 0);[m + [m + /* configure for DRAG&DROP of files */[m + if (IupGetCallback(ih, "DROPFILES_CB"))[m +[36m@@ -2309,13 +2387,23 @@[m [mstatic int gtkTreeMapMethod(Ihandle* ih)[m + [m + IupSetCallback(ih, "_IUP_XY2POS_CB", (Icallback)gtkTreeConvertXYToPos);[m + [m +[32m+[m[32m iupdrvTreeUpdateMarkMode(ih);[m +[32m+[m + return IUP_NOERROR;[m + }[m + [m +[32m+[m[32mstatic void gtkTreeUnMapMethod(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m ih->data->node_count = 0;[m +[32m+[m +[32m+[m[32m iupdrvBaseUnMapMethod(ih);[m +[32m+[m[32m}[m +[32m+[m + void iupdrvTreeInitClass(Iclass* ic)[m + {[m + /* Driver Dependent Class functions */[m + ic->Map = gtkTreeMapMethod;[m +[32m+[m[32m ic->UnMap = gtkTreeUnMapMethod;[m + [m + /* Visual */[m + iupClassRegisterAttribute(ic, "BGCOLOR", NULL, gtkTreeSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "TXTBGCOLOR", IUPAF_DEFAULT);[m +[36m@@ -2324,7 +2412,6 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + /* IupTree Attributes - GENERAL */[m + iupClassRegisterAttribute(ic, "EXPANDALL", NULL, gtkTreeSetExpandAllAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "INDENTATION", gtkTreeGetIndentationAttrib, gtkTreeSetIndentationAttrib, NULL, NULL, IUPAF_DEFAULT);[m +[31m- iupClassRegisterAttribute(ic, "COUNT", gtkTreeGetCountAttrib, NULL, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_READONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "DRAGDROP", NULL, iupgtkSetDragDropAttrib, NULL, NULL, IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "SPACING", iupTreeGetSpacingAttrib, gtkTreeSetSpacingAttrib, NULL, NULL, IUPAF_NOT_MAPPED);[m + iupClassRegisterAttribute(ic, "TOPITEM", NULL, gtkTreeSetTopItemAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m +[36m@@ -2345,7 +2432,6 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + iupClassRegisterAttributeId(ic, "COLOR", gtkTreeGetColorAttrib, gtkTreeSetColorAttrib, IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "NAME", gtkTreeGetTitleAttrib, gtkTreeSetTitleAttrib, IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TITLE", gtkTreeGetTitleAttrib, gtkTreeSetTitleAttrib, IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttributeId(ic, "USERDATA", gtkTreeGetUserDataAttrib, gtkTreeSetUserDataAttrib, IUPAF_NO_STRING|IUPAF_NO_INHERIT);[m + [m + iupClassRegisterAttributeId(ic, "CHILDCOUNT", gtkTreeGetChildCountAttrib, NULL, IUPAF_READONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TITLEFONT", gtkTreeGetTitleFontAttrib, gtkTreeSetTitleFontAttrib, IUPAF_NO_INHERIT);[m +[36m@@ -2355,6 +2441,7 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + iupClassRegisterAttribute (ic, "MARK", NULL, gtkTreeSetMarkAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute (ic, "STARTING", NULL, gtkTreeSetMarkStartAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute (ic, "MARKSTART", NULL, gtkTreeSetMarkStartAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute (ic, "MARKEDNODES", gtkTreeGetMarkedNodesAttrib, gtkTreeSetMarkedNodesAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + [m + iupClassRegisterAttribute (ic, "VALUE", gtkTreeGetValueAttrib, gtkTreeSetValueAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + [m +[36m@@ -2363,7 +2450,7 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "RENAME", NULL, gtkTreeSetRenameAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "MOVENODE", NULL, gtkTreeSetMoveNodeAttrib, IUPAF_NOT_MAPPED|IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "COPYNODE", NULL, gtkTreeSetCopyNodeAttrib, IUPAF_NOT_MAPPED|IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttributeId(ic, "FINDUSERDATA", gtkTreeGetFindUserDataAttrib, NULL, IUPAF_READONLY|IUPAF_NO_INHERIT);[m + [m +[31m- iupClassRegisterAttribute (ic, "AUTODRAGDROP", NULL, NULL, NULL, NULL, IUPAF_DEFAULT);[m +[32m+[m[32m /* IupTree Attributes - GTK Only */[m +[32m+[m[32m iupClassRegisterAttribute (ic, "RUBBERBAND", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NO_INHERIT);[m + }[m +[1mdiff --git a/iup/src/iup.c b/iup/src/iup.c[m +[1mindex df4bf34..d103af5 100755[m +[1m--- a/iup/src/iup.c[m +[1m+++ b/iup/src/iup.c[m +[36m@@ -36,8 +36,10 @@[m + * \subsection com File Comments (at start)[m + * - Check an existant file for example.[m + * [m +[31m- * \subsection inc Include Defines[m +[31m- * - __IUPXXX_H (same file name, upper case, "__" preffix and replace "." by "_")[m +[32m+[m[32m * \subsection def Defines[m +[32m+[m[32m * - __IUPXXX_H (for include file, same file name, upper case, "__" preffix and replace "." by "_")[m +[32m+[m[32m * - IUP_XXX (for enumerations)[m +[32m+[m[32m * - iupXXX (for macros, complement with Function Names rules)[m + * [m + * \subsection doc Documentation[m + * - In the header, using Doxygen commands.[m +[36m@@ -58,7 +60,7 @@[m + #include "iup.h"[m + [m + /* This appears only here to avoid changing the iup.h header fo bug fixes */[m +[31m-#define IUP_VERSION_FIX " RC3"[m +[32m+[m[32m#define IUP_VERSION_FIX ""[m + #define IUP_VERSION_FIX_NUMBER 0[m + [m + const char iup_ident[] = [m +[1mdiff --git a/iup/src/iup.def b/iup/src/iup.def[m +[1mindex d0dcfbd..56e7225 100755[m +[1m--- a/iup/src/iup.def[m +[1m+++ b/iup/src/iup.def[m +[36m@@ -27,6 +27,8 @@[m [mIupGetFunction[m + IupGetGlobal[m + IupGetHandle[m + IupGetInt[m +[32m+[m[32mIupGetInt2[m +[32m+[m[32mIupGetIntInt[m + IupGetLanguage[m + IupGetName[m + IupHbox[m +[36m@@ -40,6 +42,7 @@[m [mIupListDialog[m + IupLoad[m + IupLoadBuffer[m + IupLoopStep[m +[32m+[m[32mIupLoopStepWait[m + IupMainLoop[m + IupMap[m + IupMapFont[m +[36m@@ -68,6 +71,7 @@[m [mIupShowXY[m + IupStoreAttribute[m + IupStoreGlobal[m + IupSubmenu[m +[32m+[m[32mIupSplit[m + IupText[m + IupToggle[m + IupUnMapFont[m +[36m@@ -135,6 +139,7 @@[m [mIupTextConvertLinColToPos[m + IupTextConvertPosToLinCol[m + IupUpdateChildren[m + IupTreeSetAttribute [m +[32m+[m[32mIupTreeSetAttributeHandle[m + IupTreeStoreAttribute[m + IupTreeGetAttribute [m + IupTreeGetInt [m +[36m@@ -175,8 +180,8 @@[m [miupdrvFontGetStringWidth[m + iupdrvFontGetMultiLineStringSize[m + iupdrvFontGetCharSize[m + iupdrvDrawFocusRect[m +[31m-iupdrvDisplayUpdate[m +[31m-iupdrvDisplayRedraw[m +[32m+[m[32miupdrvPostRedraw[m +[32m+[m[32miupdrvRedrawNow[m + iupdrvBaseUnMapMethod[m + iupdrvBaseSetZorderAttrib[m + iupdrvBaseSetTipVisibleAttrib[m +[36m@@ -351,3 +356,17 @@[m [miupArrayCreate[m + iupArrayCount[m + iupArrayAdd[m + iupSaveImageAsText[m +[32m+[m[32miupDrawCreateCanvas[m +[32m+[m[32miupDrawKillCanvas[m +[32m+[m[32miupDrawFlush[m +[32m+[m[32miupDrawGetSize[m +[32m+[m[32miupDrawParentBackground[m +[32m+[m[32miupDrawRectangle[m +[32m+[m[32miupDrawLine[m +[32m+[m[32miupDrawArc[m +[32m+[m[32miupDrawPolygon[m +[32m+[m[32miupDrawResetClip[m +[32m+[m[32miupDrawSetClipRect[m +[32m+[m[32miupDrawText[m +[32m+[m[32miupDrawUpdateSize[m +[32m+[m[32miupDrawImage[m +[1mdiff --git a/iup/src/iup_attrib.c b/iup/src/iup_attrib.c[m +[1mindex 2bbb80a..bf9576e 100755[m +[1m--- a/iup/src/iup_attrib.c[m +[1m+++ b/iup/src/iup_attrib.c[m +[36m@@ -63,7 +63,7 @@[m [mchar* IupGetAttributes(Ihandle *ih)[m + name = iupTableFirst(ih->attrib);[m + while (name)[m + {[m +[31m- if (!iupAttribIsInternal(name))[m +[32m+[m[32m if (!iupATTRIB_ISINTERNAL(name))[m + {[m + if (buffer[0] != 0)[m + strcat(buffer,",");[m +[36m@@ -115,6 +115,14 @@[m [mvoid iupAttribUpdateFromParent(Ihandle* ih)[m + }[m + }[m + [m +[32m+[m[32mstatic int iAttribIsInherit(Ihandle* ih, const char* name)[m +[32m+[m[32m{[m +[32m+[m[32m int inherit;[m +[32m+[m[32m char *def_value;[m +[32m+[m[32m iupClassObjectGetAttributeInfo(ih, name, &def_value, &inherit);[m +[32m+[m[32m return inherit;[m +[32m+[m[32m}[m +[32m+[m + static void iAttribNotifyChildren(Ihandle *ih, const char* name, const char *value)[m + {[m + int inherit;[m +[36m@@ -123,17 +131,36 @@[m [mstatic void iAttribNotifyChildren(Ihandle *ih, const char* name, const char *val[m + {[m + if (!iupTableGet(child->attrib, name))[m + {[m +[31m- /* set on the class */[m +[31m- iupClassObjectSetAttribute(child, name, value, &inherit);[m +[32m+[m[32m /* set only if an inheritable attribute at the child */[m +[32m+[m[32m if (iAttribIsInherit(child, name))[m +[32m+[m[32m {[m +[32m+[m[32m /* set on the class */[m +[32m+[m[32m iupClassObjectSetAttribute(child, name, value, &inherit);[m + [m +[31m- if (inherit) /* inherit can be different for the child */[m + iAttribNotifyChildren(child, name, value);[m +[32m+[m[32m }[m + }[m + [m + child = child->brother;[m + }[m + }[m + [m +[32m+[m[32mvoid iupAttribUpdateChildren(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m char *name = iupTableFirst(ih->attrib);[m +[32m+[m[32m while (name)[m +[32m+[m[32m {[m +[32m+[m[32m if (!iupATTRIB_ISINTERNAL(name) && iAttribIsInherit(ih, name))[m +[32m+[m[32m {[m +[32m+[m[32m /* retrieve from the table */[m +[32m+[m[32m char* value = iupTableGet(ih->attrib, name);[m +[32m+[m[32m iAttribNotifyChildren(ih, name, value);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m name = iupTableNext(ih->attrib);[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m + void iupAttribUpdate(Ihandle* ih)[m + {[m + char** name_array;[m +[36m@@ -159,7 +186,7 @@[m [mvoid iupAttribUpdate(Ihandle* ih)[m + for (i = 0; i < count; i++)[m + {[m + name = name_array[i];[m +[31m- if (!iupAttribIsInternal(name))[m +[32m+[m[32m if (!iupATTRIB_ISINTERNAL(name))[m + {[m + /* retrieve from the table */[m + value = iupTableGet(ih->attrib, name);[m +[36m@@ -196,7 +223,7 @@[m [mvoid IupSetAttribute(Ihandle *ih, const char* name, const char *value)[m + if (!iupObjectCheck(ih))[m + return;[m + [m +[31m- if (iupAttribIsInternal(name))[m +[32m+[m[32m if (iupATTRIB_ISINTERNAL(name))[m + iupAttribSetStr(ih, name, value);[m + else[m + {[m +[36m@@ -225,7 +252,7 @@[m [mvoid IupStoreAttribute(Ihandle *ih, const char* name, const char *value)[m + if (!iupObjectCheck(ih))[m + return;[m + [m +[31m- if (iupAttribIsInternal(name))[m +[32m+[m[32m if (iupATTRIB_ISINTERNAL(name))[m + iupAttribStoreStr(ih, name, value);[m + else[m + {[m +[36m@@ -257,7 +284,7 @@[m [mchar* IupGetAttribute(Ihandle *ih, const char* name)[m + if (!value)[m + value = iupAttribGet(ih, name);[m + [m +[31m- if (!value && !iupAttribIsInternal(name))[m +[32m+[m[32m if (!value && !iupATTRIB_ISINTERNAL(name))[m + {[m + if (inherit)[m + {[m +[36m@@ -346,6 +373,16 @@[m [mvoid iupAttribSetHandleName(Ihandle *ih)[m + IupSetHandle(str_name, ih);[m + }[m + [m +[32m+[m[32mchar* iupAttribGetHandleName(Ihandle *ih)[m +[32m+[m[32m{[m +[32m+[m[32m char str_name[100];[m +[32m+[m[32m sprintf(str_name, "_IUP_NAME(%p)", ih);[m +[32m+[m[32m if (IupGetHandle(str_name)==ih)[m +[32m+[m[32m return iupStrGetMemoryCopy(str_name);[m +[32m+[m[32m else[m +[32m+[m[32m return NULL;[m +[32m+[m[32m}[m +[32m+[m + void IupSetAttributeHandle(Ihandle *ih, const char* name, Ihandle *ih_named)[m + {[m + int inherit;[m +[36m@@ -426,7 +463,7 @@[m [mvoid iupAttribSetInt(Ihandle *ih, const char* name, int num)[m + [m + void iupAttribSetFloat(Ihandle *ih, const char* name, float num)[m + {[m +[31m- iupAttribSetStrf(ih, name, "%f", (double)num);[m +[32m+[m[32m iupAttribSetStrf(ih, name, "%g", (double)num);[m + }[m + [m + int iupAttribGetBoolean(Ihandle* ih, const char* name)[m +[36m@@ -479,7 +516,7 @@[m [mchar* iupAttribGetStr(Ihandle* ih, const char* name)[m + [m + value = iupTableGet(ih->attrib, name);[m + [m +[31m- if (!value && !iupAttribIsInternal(name))[m +[32m+[m[32m if (!value && !iupATTRIB_ISINTERNAL(name))[m + {[m + int inherit;[m + char *def_value;[m +[36m@@ -555,6 +592,15 @@[m [mstatic void iAttribCapture(char* env_buffer, char* dlm)[m + env_buffer[i-1]='\0'; /* discard delimiter */[m + }[m + [m +[32m+[m[32mstatic void iAttribSkipComment(void)[m +[32m+[m[32m{[m +[32m+[m[32m int c;[m +[32m+[m[32m do[m +[32m+[m[32m {[m +[32m+[m[32m c = *env_str; ++env_str;[m +[32m+[m[32m } while ((c > 0) && (c != '\n'));[m +[32m+[m[32m}[m +[32m+[m + static int iAttribToken(char* env_buffer)[m + {[m + for (;;)[m +[36m@@ -565,6 +611,11 @@[m [mstatic int iAttribToken(char* env_buffer)[m + case 0:[m + return IUPLEX_TK_END;[m + [m +[32m+[m[32m case '#': /* Skip comment */[m +[32m+[m[32m case '%': /* Skip comment */[m +[32m+[m[32m iAttribSkipComment();[m +[32m+[m[32m continue;[m +[32m+[m + case ' ': /* ignore whitespace */[m + case '\t':[m + case '\n':[m +[36m@@ -609,7 +660,7 @@[m [mstatic void iAttribParse(Ihandle *ih, const char* str)[m + {[m + switch (iAttribToken(env_buffer))[m + {[m +[31m- case IUPLEX_TK_END: /* procedimento igual ao IUPLEX_TK_COMMA */[m +[32m+[m[32m case IUPLEX_TK_END: /* same as IUPLEX_TK_COMMA */[m + end = 1;[m + case IUPLEX_TK_COMMA:[m + if (name)[m +[1mdiff --git a/iup/src/iup_attrib.h b/iup/src/iup_attrib.h[m +[1mindex 993dd3c..8593d6e 100755[m +[1m--- a/iup/src/iup_attrib.h[m +[1m+++ b/iup/src/iup_attrib.h[m +[36m@@ -28,7 +28,7 @@[m [mextern "C" {[m + [m + /** Returns true if the attribute name if in the internal format "_IUP...".[m + * \ingroup attrib */[m +[31m-#define iupAttribIsInternal(_name) ((_name[0] == '_' && _name[1] == 'I' && _name[2] == 'U' && _name[3] == 'P')? 1: 0)[m +[32m+[m[32m#define iupATTRIB_ISINTERNAL(_name) ((_name[0] == '_' && _name[1] == 'I' && _name[2] == 'U' && _name[3] == 'P')? 1: 0)[m + [m + /** Returns true if the attribute name is a known pointer.[m + * \ingroup attrib */[m +[36m@@ -102,16 +102,23 @@[m [mfloat iupAttribGetFloat(Ihandle* ih, const char* name);[m + * \ingroup attrib */[m + void iupAttribSetHandleName(Ihandle *ih);[m + [m +[32m+[m[32m/** Returns the internal name if set.[m +[32m+[m[32m * \ingroup attrib */[m +[32m+[m[32mchar* iupAttribGetHandleName(Ihandle *ih);[m +[32m+[m + [m + /* For all attributes in the evironment, call the class SetAttribute only.[m +[31m- * Called only after the element is mapped. */[m +[32m+[m[32m * Called only after the element is mapped, but before the children are mapped. */[m + void iupAttribUpdate(Ihandle* ih); [m + [m + /* For all registered inherited attributes, checks the parent tree and [m + * call the class SetAttribute if the attribute is defined.[m +[31m- * Called only after the element is mapped. */[m +[32m+[m[32m * Called only after the element is mapped, but before the children are mapped. */[m + void iupAttribUpdateFromParent(Ihandle* ih);[m + [m +[32m+[m[32m/* For all attributes in the evironment, call the class SetAttribute only for the children.[m +[32m+[m[32m * Called only after the element is mapped, and after the children are mapped. */[m +[32m+[m[32mvoid iupAttribUpdateChildren(Ihandle* ih);[m + [m + [m + /* Other functions declared in <iup.h> and implemented here. [m +[1mdiff --git a/iup/src/iup_box.c b/iup/src/iup_box.c[m +[1mindex 54e56d9..111cab4 100755[m +[1m--- a/iup/src/iup_box.c[m +[1m+++ b/iup/src/iup_box.c[m +[36m@@ -172,9 +172,9 @@[m [mstatic int iBoxSetCMarginAttrib(Ihandle* ih, const char* value)[m + iupdrvFontGetCharSize(ih, &charwidth, &charheight);[m + iupStrToIntInt(value, &cmargin_x, &cmargin_y, 'x');[m + if (cmargin_x!=-1)[m +[31m- ih->data->margin_x = iupHEIGHT2RASTER(cmargin_x, charheight);[m +[32m+[m[32m ih->data->margin_x = iupWIDTH2RASTER(cmargin_x, charwidth);[m + if (cmargin_y!=-1)[m +[31m- ih->data->margin_x = iupWIDTH2RASTER(cmargin_y, charwidth);[m +[32m+[m[32m ih->data->margin_y = iupHEIGHT2RASTER(cmargin_y, charheight);[m + return 0;[m + }[m + [m +[36m@@ -227,8 +227,12 @@[m [mIclass* iupBoxClassBase(void)[m + /* boxes only */[m + iupClassRegisterAttribute(ic, "GAP", iBoxGetGapAttrib, iBoxSetGapAttrib, IUPAF_SAMEASSYSTEM, "0", IUPAF_NOT_MAPPED);[m + iupClassRegisterAttribute(ic, "CGAP", iBoxGetCGapAttrib, iBoxSetCGapAttrib, IUPAF_SAMEASSYSTEM, "0", IUPAF_NOT_MAPPED);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "NGAP", iBoxGetGapAttrib, iBoxSetGapAttrib, IUPAF_SAMEASSYSTEM, "0", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "NCGAP", iBoxGetCGapAttrib, iBoxSetCGapAttrib, IUPAF_SAMEASSYSTEM, "0", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "MARGIN", iBoxGetMarginAttrib, iBoxSetMarginAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED);[m + iupClassRegisterAttribute(ic, "CMARGIN", iBoxGetCMarginAttrib, iBoxSetCMarginAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "NMARGIN", iBoxGetMarginAttrib, iBoxSetMarginAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "NCMARGIN", iBoxGetCMarginAttrib, iBoxSetCMarginAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + [m + iupClassRegisterAttribute(ic, "EXPANDCHILDREN", iBoxGetExpandChildrenAttrib, iBoxSetExpandChildrenAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "HOMOGENEOUS", iBoxGetHomogeneousAttrib, iBoxSetHomogeneousAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[1mdiff --git a/iup/src/iup_button.c b/iup/src/iup_button.c[m +[1mindex 7719663..56befe2 100755[m +[1m--- a/iup/src/iup_button.c[m +[1m+++ b/iup/src/iup_button.c[m +[36m@@ -100,8 +100,9 @@[m [mstatic void iButtonComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *ex[m + char* value = iupAttribGet(ih, "IMAGE");[m + if (value)[m + {[m +[32m+[m[32m char* title = iupAttribGet(ih, "TITLE");[m + type = IUP_BUTTON_IMAGE;[m +[31m- if (iupAttribGet(ih, "TITLE"))[m +[32m+[m[32m if (title && *title!=0)[m + type |= IUP_BUTTON_TEXT;[m + }[m + else[m +[1mdiff --git a/iup/src/iup_canvas.c b/iup/src/iup_canvas.c[m +[1mindex 5eda988..46fefd9 100755[m +[1m--- a/iup/src/iup_canvas.c[m +[1m+++ b/iup/src/iup_canvas.c[m +[36m@@ -55,14 +55,14 @@[m [mvoid iupCanvasCalcScrollRealPos(double min, double max, double *pos,[m + char* iupCanvasGetPosXAttrib(Ihandle* ih)[m + {[m + char* str = iupStrGetMemory(20);[m +[31m- sprintf(str, "%f", ih->data->posx);[m +[32m+[m[32m sprintf(str, "%g", ih->data->posx);[m + return str;[m + }[m + [m + char* iupCanvasGetPosYAttrib(Ihandle* ih)[m + {[m + char* str = iupStrGetMemory(20);[m +[31m- sprintf(str, "%f", ih->data->posy);[m +[32m+[m[32m sprintf(str, "%g", ih->data->posy);[m + return str;[m + }[m + [m +[1mdiff --git a/iup/src/iup_classattrib.c b/iup/src/iup_classattrib.c[m +[1mindex df8f873..3ac780c 100755[m +[1m--- a/iup/src/iup_classattrib.c[m +[1m+++ b/iup/src/iup_classattrib.c[m +[36m@@ -55,7 +55,7 @@[m [mstatic const char* iClassFindId(const char* name)[m + {[m + if (*name >= '0' && *name <= '9')[m + return name;[m +[31m- if (*name == '*' || *name == ':')[m +[32m+[m[32m if (*name == '*' || *name == ':' || *name == '-')[m + return name;[m + [m + name++;[m +[36m@@ -94,7 +94,6 @@[m [mint iupClassObjectSetAttribute(Ihandle* ih, const char* name, const char * value[m + const char* name_id = iClassFindId(name);[m + if (name_id)[m + {[m +[31m- IattribFunc* afunc;[m + const char* partial_name = iClassCutNameId(name, name_id);[m + if (!partial_name)[m + partial_name = "IDVALUE"; /* pure numbers are used as attributes in IupList and IupMatrix, [m +[36m@@ -474,8 +473,12 @@[m [mvoid iupClassObjectEnsureDefaultAttributes(Ihandle* ih)[m + (afunc->call_global_default && iupGlobalDefaultColorChanged(afunc->default_value)))[m + {[m + if ((!ih->handle && (afunc->flags & IUPAF_NOT_MAPPED)) ||[m +[31m- (ih->handle && !(afunc->flags & IUPAF_NOT_MAPPED) && !iupAttribGet(ih, name)))[m +[31m- afunc->set(ih, iClassGetDefaultValue(afunc));[m +[32m+[m[32m (ih->handle && !(afunc->flags & IUPAF_NOT_MAPPED)))[m +[32m+[m[32m {[m +[32m+[m[32m char* value = iupAttribGet(ih, name);[m +[32m+[m[32m if (!value) /* if set will be updated later */[m +[32m+[m[32m afunc->set(ih, iClassGetDefaultValue(afunc));[m +[32m+[m[32m }[m + }[m + }[m + [m +[1mdiff --git a/iup/src/iup_classbase.c b/iup/src/iup_classbase.c[m +[1mindex 9cb9e63..03a98d1 100755[m +[1m--- a/iup/src/iup_classbase.c[m +[1m+++ b/iup/src/iup_classbase.c[m +[36m@@ -164,8 +164,7 @@[m [mstatic char* iBaseGetPositionAttrib(Ihandle* ih)[m + [m + static int iBaseSetPositionAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- if (ih->is_floating)[m +[31m- iupStrToIntInt(value, &ih->x, &ih->y, ',');[m +[32m+[m[32m iupStrToIntInt(value, &ih->x, &ih->y, ',');[m + return 0;[m + }[m + [m +[36m@@ -211,7 +210,7 @@[m [mchar* iupBaseGetVisibleAttrib(Ihandle* ih)[m + int iupBaseSetVisibleAttrib(Ihandle* ih, const char* value)[m + {[m + iupdrvSetVisible(ih, iupStrBoolean(value));[m +[31m- return 0;[m +[32m+[m[32m return 1; /* must be 1 to mark when set at the element */[m + }[m + [m + char* iupBaseNativeParentGetBgColorAttrib(Ihandle* ih)[m +[36m@@ -410,15 +409,19 @@[m [mvoid iupBaseRegisterCommonAttrib(Iclass* ic)[m + iupClassRegisterAttribute(ic, "FLOATING", iBaseGetFloatingAttrib, iBaseSetFloatingAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "EXPAND", iBaseGetExpandAttrib, iBaseSetExpandAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "NORMALIZERGROUP", NULL, iBaseSetNormalizerGroupAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "EXPANDWEIGTH", NULL, NULL, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + [m + /* make sure everyone has the correct default value */[m +[31m- iupClassRegisterAttribute(ic, "VISIBLE", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_DEFAULT);[m + iupClassRegisterAttribute(ic, "ACTIVE", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_DEFAULT);[m + if (ic->is_interactive)[m + iupClassRegisterAttribute(ic, "CANFOCUS", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NO_INHERIT);[m + else[m + iupClassRegisterAttribute(ic, "CANFOCUS", NULL, NULL, IUPAF_SAMEASSYSTEM, "NO", IUPAF_NO_INHERIT);[m + [m +[32m+[m[32m /* if not native container, must set at children,[m +[32m+[m[32m native container will automatically hide its children. */[m +[32m+[m[32m iupClassRegisterAttribute(ic, "VISIBLE", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_DEFAULT); /* let the attribute to be propagated to children */[m +[32m+[m + iupClassRegisterAttribute(ic, "SIZE", iupBaseGetSizeAttrib, iupBaseSetSizeAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "RASTERSIZE", iupBaseGetRasterSizeAttrib, iupBaseSetRasterSizeAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "CHARSIZE", iupBaseGetCharSizeAttrib, NULL, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_READONLY|IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[36m@@ -439,7 +442,7 @@[m [mvoid iupBaseRegisterCommonAttrib(Iclass* ic)[m + [m + void iupBaseRegisterVisualAttrib(Iclass* ic)[m + {[m +[31m- iupClassRegisterAttribute(ic, "VISIBLE", iupBaseGetVisibleAttrib, iupBaseSetVisibleAttrib, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NO_INHERIT); /* VISIBLE inheritance comes from the native system */[m +[32m+[m[32m iupClassRegisterAttribute(ic, "VISIBLE", iupBaseGetVisibleAttrib, iupBaseSetVisibleAttrib, "YES", "NO", IUPAF_DEFAULT);[m + iupClassRegisterAttribute(ic, "ACTIVE", iupBaseGetActiveAttrib, iupBaseSetActiveAttrib, IUPAF_SAMEASSYSTEM, "YES", IUPAF_DEFAULT);[m + [m + iupClassRegisterAttribute(ic, "ZORDER", NULL, iupdrvBaseSetZorderAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m +[1mdiff --git a/iup/src/iup_dialog.c b/iup/src/iup_dialog.c[m +[1mindex d70e12c..1aaf095 100755[m +[1m--- a/iup/src/iup_dialog.c[m +[1m+++ b/iup/src/iup_dialog.c[m +[36m@@ -220,11 +220,19 @@[m [mstatic void iDialogDestroyMethod(Ihandle* ih)[m + iupDlgListRemove(ih);[m + }[m + [m +[32m+[m[32mstatic int iDialogSetMenuAttrib(Ihandle* ih, const char* value);[m +[32m+[m + static void iDialogComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)[m + {[m + int decorwidth, decorheight;[m + Ihandle* child = ih->firstchild;[m + [m +[32m+[m[32m /* if does not have a menu, but the attribute is defined,[m +[32m+[m[32m try to update the menu before retrieving the decoration. */[m +[32m+[m[32m char* value = iupAttribGet(ih, "MENU");[m +[32m+[m[32m if (!ih->data->menu && value)[m +[32m+[m[32m iDialogSetMenuAttrib(ih, value);[m +[32m+[m + iupDialogGetDecorSize(ih, &decorwidth, &decorheight);[m + *w = decorwidth;[m + *h = decorheight;[m +[36m@@ -278,20 +286,22 @@[m [mstatic void iDialogAfterShow(Ihandle* ih)[m + {[m + Ihandle* old_focus;[m + IFni show_cb;[m +[32m+[m[32m int show_state;[m + [m + /* process all pending messages */[m + IupFlush();[m + [m + old_focus = IupGetFocus();[m +[32m+[m[32m show_state = ih->data->show_state;[m + [m + show_cb = (IFni)IupGetCallback(ih, "SHOW_CB");[m +[31m- if (show_cb && show_cb(ih, ih->data->show_state) == IUP_CLOSE)[m +[32m+[m[32m if (show_cb && show_cb(ih, show_state) == IUP_CLOSE)[m + {[m + IupExitLoop();[m + return;[m + }[m + [m +[31m- if (ih->data->show_state == IUP_SHOW)[m +[32m+[m[32m if (show_state == IUP_SHOW)[m + {[m + if (show_cb)[m + IupFlush(); /* again to update focus */[m +[36m@@ -718,7 +728,8 @@[m [mIclass* iupDialogGetClass(void)[m + iupBaseRegisterVisualAttrib(ic);[m + [m + /* Overwrite Visual */[m +[31m- iupClassRegisterAttribute(ic, "VISIBLE", iupBaseGetVisibleAttrib, iDialogSetVisibleAttrib, IUPAF_SAMEASSYSTEM, "NO", IUPAF_NO_INHERIT); /* the only case where VISIBLE default is NO */[m +[32m+[m[32m /* the only case where VISIBLE default is NO, and must not be propagated to the dialog children */[m +[32m+[m[32m iupClassRegisterAttribute(ic, "VISIBLE", iupBaseGetVisibleAttrib, iDialogSetVisibleAttrib, IUPAF_SAMEASSYSTEM, "NO", IUPAF_NO_INHERIT);[m[41m [m + [m + /* IupDialog only */[m + iupClassRegisterAttribute(ic, "MENU", NULL, iDialogSetMenuAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[1mdiff --git a/iup/src/iup_drv.h b/iup/src/iup_drv.h[m +[1mindex 5cdb8e7..1071347 100755[m +[1m--- a/iup/src/iup_drv.h[m +[1m+++ b/iup/src/iup_drv.h[m +[36m@@ -60,11 +60,11 @@[m [mvoid iupdrvSetActive(Ihandle* ih, int enable);[m + [m + /** Post a redraw of a control.[m + * \ingroup drv */[m +[31m-void iupdrvDisplayUpdate(Ihandle *ih);[m +[32m+[m[32mvoid iupdrvPostRedraw(Ihandle *ih);[m + [m + /** Force a redraw of a control.[m + * \ingroup drv */[m +[31m-void iupdrvDisplayRedraw(Ihandle *ih);[m +[32m+[m[32mvoid iupdrvRedrawNow(Ihandle *ih);[m + [m + /** Reparent the native control.[m + * \ingroup drv */[m +[1mdiff --git a/iup/src/iup_focus.c b/iup/src/iup_focus.c[m +[1mindex be54b75..fc0579c 100755[m +[1m--- a/iup/src/iup_focus.c[m +[1m+++ b/iup/src/iup_focus.c[m +[36m@@ -220,15 +220,25 @@[m [mvoid iupFocusPrevious(Ihandle *ih)[m + /* local variables */[m + static Ihandle* iup_current_focus = NULL;[m + [m +[32m+[m[32mIhandle* IupGetFocus(void)[m +[32m+[m[32m{[m +[32m+[m[32m return iup_current_focus;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupSetCurrentFocus(Ihandle *ih)[m +[32m+[m[32m{[m +[32m+[m[32m iup_current_focus = ih;[m +[32m+[m[32m}[m +[32m+[m + Ihandle *IupSetFocus(Ihandle *ih)[m + {[m +[31m- Ihandle* old_focus = iup_current_focus;[m +[32m+[m[32m Ihandle* old_focus = IupGetFocus();[m + [m + iupASSERT(iupObjectCheck(ih));[m + if (!iupObjectCheck(ih))[m + return old_focus;[m + [m +[31m- /* iup_current_focus is NOT set here, [m +[32m+[m[32m /* Current focus is NOT set here,[m[41m [m + only in the iupCallGetFocusCb */[m + [m + if (iupFocusCanAccept(ih)) [m +[36m@@ -237,16 +247,11 @@[m [mIhandle *IupSetFocus(Ihandle *ih)[m + return old_focus;[m + }[m + [m +[31m-Ihandle *IupGetFocus(void)[m +[31m-{[m +[31m- return iup_current_focus;[m +[31m-}[m +[31m-[m + void iupCallGetFocusCb(Ihandle *ih)[m + {[m + Icallback cb;[m + [m +[31m- if (ih == iup_current_focus) /* avoid duplicate messages */[m +[32m+[m[32m if (ih == IupGetFocus()) /* avoid duplicate messages */[m + return;[m + [m + cb = (Icallback)IupGetCallback(ih, "GETFOCUS_CB");[m +[36m@@ -258,14 +263,14 @@[m [mvoid iupCallGetFocusCb(Ihandle *ih)[m + if (cb2) cb2(ih, 1);[m + }[m + [m +[31m- iup_current_focus = ih;[m +[32m+[m[32m iupSetCurrentFocus(ih);[m + }[m + [m + void iupCallKillFocusCb(Ihandle *ih)[m + {[m + Icallback cb;[m + [m +[31m- if (ih != iup_current_focus) /* avoid duplicate messages */[m +[32m+[m[32m if (ih != IupGetFocus()) /* avoid duplicate messages */[m + return;[m + [m + cb = IupGetCallback(ih, "KILLFOCUS_CB");[m +[36m@@ -277,5 +282,5 @@[m [mvoid iupCallKillFocusCb(Ihandle *ih)[m + if (cb2) cb2(ih, 0);[m + }[m + [m +[31m- iup_current_focus = NULL;[m +[32m+[m[32m iupSetCurrentFocus(NULL);[m + }[m +[1mdiff --git a/iup/src/iup_focus.h b/iup/src/iup_focus.h[m +[1mindex 239e233..9fb4e58 100755[m +[1m--- a/iup/src/iup_focus.h[m +[1m+++ b/iup/src/iup_focus.h[m +[36m@@ -39,6 +39,7 @@[m [mIhandle* iupFocusNextInteractive(Ihandle *ih);[m + void iupFocusNext(Ihandle *ih);[m + void iupFocusPrevious(Ihandle *ih);[m + [m +[32m+[m[32mvoid iupSetCurrentFocus(Ihandle *ih);[m + [m + /* Other functions declared in <iup.h> and implemented here. [m + IupPreviousField[m +[1mdiff --git a/iup/src/iup_getparam.c b/iup/src/iup_getparam.c[m +[1mindex 1418aa5..7fd6a94 100755[m +[1m--- a/iup/src/iup_getparam.c[m +[1m+++ b/iup/src/iup_getparam.c[m +[36m@@ -45,6 +45,14 @@[m [mstatic int iParamButtonCancel_CB(Ihandle* self)[m + return IUP_CLOSE;[m + }[m + [m +[32m+[m[32mstatic int iParamButtonHelp_CB(Ihandle* self)[m +[32m+[m[32m{[m +[32m+[m[32m Ihandle* dlg = IupGetDialog(self);[m +[32m+[m[32m Iparamcb cb = (Iparamcb)IupGetCallback(dlg, "PARAM_CB");[m +[32m+[m[32m if (cb) cb(dlg, -4, (void*)iupAttribGet(dlg, "USER_DATA"));[m +[32m+[m[32m return IUP_DEFAULT;[m +[32m+[m[32m}[m +[32m+[m + static int iParamToggleAction_CB(Ihandle *self, int v)[m + {[m + Ihandle* param = (Ihandle*)iupAttribGetInherit(self, "_IUPGP_PARAM");[m +[36m@@ -288,7 +296,7 @@[m [mstatic int iParamColorButton_CB(Ihandle *self, int button, int pressed)[m + [m + IupPopup(dlg, IUP_CENTER, IUP_CENTER);[m + [m +[31m- if (IupGetInt(dlg, "STATUS") != -1)[m +[32m+[m[32m if (IupGetInt(dlg, "STATUS")==1)[m + {[m + char* value = IupGetAttribute(dlg, "VALUE");[m + IupSetAttribute(textbox, "VALUE", value);[m +[36m@@ -381,11 +389,13 @@[m [mstatic int iParamSpinInt_CB(Ihandle *self, int pos)[m + static Ihandle* iParamCreateBox(Ihandle* param)[m + {[m + Ihandle *box, *ctrl = NULL, *label;[m +[31m- char *type;[m +[32m+[m[32m char *type = iupAttribGet(param, "TYPE");[m +[32m+[m +[32m+[m[32m if (iupStrEqual(type, "BUTTONNAMES"))[m +[32m+[m[32m return NULL;[m + [m + label = IupLabel(iupAttribGet(param, "TITLE"));[m + [m +[31m- type = iupAttribGet(param, "TYPE");[m + if (iupStrEqual(type, "SEPARATOR"))[m + {[m + box = IupHbox(label, NULL);[m +[36m@@ -563,7 +573,7 @@[m [mstatic Ihandle* iParamCreateBox(Ihandle* param)[m + float step = iupAttribGetFloat(param, "STEP");[m + float val = iupAttribGetFloat(param, "VALUE");[m + if (step == 0) step = (max-min)/20.0f;[m +[31m- IupSetfAttribute(ctrl, "MASKFLOAT", "%f:%f", (double)min, (double)max);[m +[32m+[m[32m IupSetfAttribute(ctrl, "MASKFLOAT", "%g:%g", (double)min, (double)max);[m + [m + /* here spin is always [0-spinmax] converted to [min-max] */[m + [m +[36m@@ -584,7 +594,7 @@[m [mstatic Ihandle* iParamCreateBox(Ihandle* param)[m + if (min == 0)[m + IupSetAttribute(ctrl, "MASK", IUP_MASK_UFLOAT);[m + else[m +[31m- IupSetfAttribute(ctrl, "MASKFLOAT", "%f:%f", (double)min, (double)1.0e10);[m +[32m+[m[32m IupSetfAttribute(ctrl, "MASKFLOAT", "%g:%g", (double)min, (double)1.0e10);[m + IupAppend(box, ctrl);[m + }[m + else[m +[36m@@ -620,6 +630,7 @@[m [mstatic Ihandle* iParamCreateBox(Ihandle* param)[m + }[m + IupSetfAttribute(ctrl, "SPINMAX", "%d", max);[m + IupSetfAttribute(ctrl, "SPINMIN", "%d", min);[m +[32m+[m[32m IupSetfAttribute(ctrl, "MASKINT", "%d:%d", min, max);[m + }[m + else if (iupAttribGetInt(param, "PARTIAL"))[m + {[m +[36m@@ -696,7 +707,7 @@[m [mstatic Ihandle* iParamCreateBox(Ihandle* param)[m + [m + static Ihandle* IupParamDlgP(Ihandle** params)[m + {[m +[31m- Ihandle *dlg, *button_ok, *button_cancel, [m +[32m+[m[32m Ihandle *dlg, *button_ok, *button_cancel, *button_help=NULL,[m[41m [m + *dlg_box, *button_box, *param_box;[m + int i, lbl_width, p, expand;[m + [m +[36m@@ -713,7 +724,23 @@[m [mstatic Ihandle* IupParamDlgP(Ihandle** params)[m + i = 0; expand = 0;[m + while (params[i] != NULL)[m + {[m +[31m- IupAppend(param_box, iParamCreateBox(params[i]));[m +[32m+[m[32m Ihandle* box = iParamCreateBox(params[i]);[m +[32m+[m[32m if (box)[m +[32m+[m[32m IupAppend(param_box, box);[m +[32m+[m[32m else /* buttonnames */[m +[32m+[m[32m {[m +[32m+[m[32m char* value = iupAttribGet(params[i], "_IUPGP_OK");[m +[32m+[m[32m if (value && *value) IupSetAttribute(button_ok, "TITLE", value);[m +[32m+[m[32m value = iupAttribGet(params[i], "_IUPGP_CANCEL");[m +[32m+[m[32m if (value && *value) IupSetAttribute(button_cancel, "TITLE", value);[m +[32m+[m[32m value = iupAttribGet(params[i], "_IUPGP_HELP");[m +[32m+[m[32m if (value && *value)[m[41m [m +[32m+[m[32m {[m +[32m+[m[32m button_help = IupButton(value, NULL);[m +[32m+[m[32m IupSetAttribute(button_help, "PADDING", "20x0");[m +[32m+[m[32m IupSetCallback(button_help, "ACTION", (Icallback)iParamButtonHelp_CB);[m +[32m+[m[32m }[m +[32m+[m[32m }[m + [m + if (IupGetInt(params[i], "EXPAND"))[m + expand = 1;[m +[36m@@ -725,6 +752,7 @@[m [mstatic Ihandle* IupParamDlgP(Ihandle** params)[m + IupFill(),[m + button_ok,[m + button_cancel,[m +[32m+[m[32m button_help,[m + NULL);[m + IupSetAttribute(button_box,"MARGIN","0x0");[m + IupSetAttribute(button_box, "NORMALIZESIZE", "HORIZONTAL");[m +[36m@@ -926,6 +954,23 @@[m [mstatic void iParamSetFileOptions(char* extra, Ihandle* param)[m + iupAttribStoreStr(param, "_IUPGP_NOOVERWRITEPROMPT", nooverwriteprompt);[m + }[m + [m +[32m+[m[32mstatic void iParamSetButtonNames(char* extra, Ihandle* param)[m +[32m+[m[32m{[m +[32m+[m[32m char *ok, *cancel, *help;[m +[32m+[m[32m int count;[m +[32m+[m +[32m+[m[32m if (!extra)[m +[32m+[m[32m return;[m +[32m+[m +[32m+[m[32m ok = iParamGetNextStrItem(extra, ',', &count); extra += count;[m +[32m+[m[32m cancel = iParamGetNextStrItem(extra, ',', &count); extra += count;[m +[32m+[m[32m help = iParamGetNextStrItem(extra, ',', &count); extra += count;[m +[32m+[m +[32m+[m[32m iupAttribStoreStr(param, "_IUPGP_OK", ok);[m +[32m+[m[32m iupAttribStoreStr(param, "_IUPGP_CANCEL", cancel);[m +[32m+[m[32m iupAttribStoreStr(param, "_IUPGP_HELP", help);[m +[32m+[m[32m}[m +[32m+[m + static void iParamSetListItems(char* extra, Ihandle* param)[m + {[m + int d = 1, count;[m +[36m@@ -1082,6 +1127,12 @@[m [mstatic Ihandle *IupParamf(const char* format, int *line_size)[m + iupAttribSetStr(param, "TYPE", "SEPARATOR");[m + iupAttribSetStr(param, "DATA_TYPE", "-1"); /* NONE */[m + break;[m +[32m+[m[32m case 'u':[m +[32m+[m[32m iupAttribSetStr(param, "TYPE", "BUTTONNAMES");[m +[32m+[m[32m iupAttribSetStr(param, "DATA_TYPE", "-1"); /* NONE */[m +[32m+[m[32m extra = iParamGetStrExtra(line_ptr, '[', ']', &count); line_ptr += count;[m +[32m+[m[32m iParamSetButtonNames(extra, param);[m +[32m+[m[32m break;[m + default:[m + return NULL;[m + }[m +[36m@@ -1099,7 +1150,7 @@[m [mstatic Ihandle *IupParamf(const char* format, int *line_size)[m + [m + int iupGetParamCount(const char *format, int *param_extra)[m + {[m +[31m- int param_count = 0, sep = 0;[m +[32m+[m[32m int param_count = 0, extra = 0;[m + const char* s = format;[m + [m + *param_extra = 0;[m +[36m@@ -1107,14 +1158,20 @@[m [mint iupGetParamCount(const char *format, int *param_extra)[m + {[m + if (*s == '%' && *(s+1) == 't') /* do not count separator lines */[m + {[m +[31m- sep = 1;[m +[32m+[m[32m extra = 1;[m +[32m+[m[32m (*param_extra)++;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m if (*s == '%' && *(s+1) == 'u') /* do not count button names lines */[m +[32m+[m[32m {[m +[32m+[m[32m extra = 1;[m + (*param_extra)++;[m + }[m + [m + if (*s == '\n')[m + {[m +[31m- if (sep)[m +[31m- sep = 0;[m +[32m+[m[32m if (extra)[m +[32m+[m[32m extra = 0;[m + else[m + param_count++;[m + }[m +[36m@@ -1154,21 +1211,21 @@[m [mint IupGetParamv(const char* title, Iparamcb action, void* user_data, const char[m + return 0;[m + [m + data_type = IupGetInt(params[i], "DATA_TYPE");[m +[31m- if (data_type == 1)[m +[31m- {[m +[31m- int *data_int = (int*)(param_data[p]);[m +[31m- if (!data_int) return 0;[m +[31m- iupAttribSetStrf(params[i], "VALUE", "%d", *data_int);[m +[31m- p++;[m +[31m- }[m +[31m- else if (data_type == 2)[m +[32m+[m[32m if (data_type == 2) /* float */[m + {[m + float *data_float = (float*)(param_data[p]);[m + if (!data_float) return 0;[m + iupAttribSetStrf(params[i], "VALUE", "%g", *data_float);[m + p++;[m + }[m +[31m- else if (data_type == 0)[m +[32m+[m[32m else if (data_type == 1) /* integer */[m +[32m+[m[32m {[m +[32m+[m[32m int *data_int = (int*)(param_data[p]);[m +[32m+[m[32m if (!data_int) return 0;[m +[32m+[m[32m iupAttribSetStrf(params[i], "VALUE", "%d", *data_int);[m +[32m+[m[32m p++;[m +[32m+[m[32m }[m +[32m+[m[32m else if (data_type == 0) /* string */[m + {[m + char *data_str = (char*)(param_data[p]);[m + if (!data_str) return 0;[m +[1mdiff --git a/iup/src/iup_globalattrib.c b/iup/src/iup_globalattrib.c[m +[1mindex 00586fb..d1a2584 100755[m +[1m--- a/iup/src/iup_globalattrib.c[m +[1m+++ b/iup/src/iup_globalattrib.c[m +[36m@@ -129,12 +129,14 @@[m [mint iupGlobalIsPointer(const char* name)[m + static struct {[m + const char *name;[m + } ptr_table[] = {[m +[31m-#ifdef WIN32[m +[32m+[m[32m#ifndef GTK_MAC[m +[32m+[m[32m #ifdef WIN32[m + {"HINSTANCE"},[m +[31m-#else[m +[32m+[m[32m #else[m + {"XDISPLAY"},[m + {"XSCREEN"},[m + {"APPSHELL"},[m +[32m+[m[32m #endif[m + #endif[m + };[m + #define PTR_TABLE_SIZE ((sizeof ptr_table)/(sizeof ptr_table[0]))[m +[1mdiff --git a/iup/src/iup_hbox.c b/iup/src/iup_hbox.c[m +[1mindex e790636..a8a93a3 100755[m +[1m--- a/iup/src/iup_hbox.c[m +[1m+++ b/iup/src/iup_hbox.c[m +[36m@@ -213,6 +213,13 @@[m [mstatic void iHboxSetChildrenCurrentSizeMethod(Ihandle* ih, int shrink)[m + else[m + {[m + int empty = (child->expand & IUP_EXPAND_W1)? empty_w1: ((child->expand & IUP_EXPAND_W0)? empty_w0: 0);[m +[32m+[m[32m char* weigth_str = iupAttribGet(child, "EXPANDWEIGTH");[m +[32m+[m[32m if (weigth_str)[m +[32m+[m[32m {[m +[32m+[m[32m float weigth;[m[41m [m +[32m+[m[32m if (iupStrToFloat(weigth_str, &weigth))[m +[32m+[m[32m empty = iupROUND(empty * weigth);[m +[32m+[m[32m }[m + iupBaseSetCurrentSize(child, child->naturalwidth+empty, client_height, shrink);[m + }[m + [m +[1mdiff --git a/iup/src/iup_key.h b/iup/src/iup_key.h[m +[1mindex 37d6c9d..9b30bc4 100755[m +[1m--- a/iup/src/iup_key.h[m +[1m+++ b/iup/src/iup_key.h[m +[36m@@ -51,16 +51,16 @@[m [mvoid iupKeyInit(void);[m + [m + #define IUPKEY_STATUS_SIZE 11 /* 10 chars + null */[m + #define IUPKEY_STATUS_INIT " " /* 10 spaces */[m +[31m-#define iupKEYSETSHIFT(_s) (_s[0]='S')[m +[31m-#define iupKEYSETCONTROL(_s) (_s[1]='C')[m +[31m-#define iupKEYSETBUTTON1(_s) (_s[2]='1')[m +[31m-#define iupKEYSETBUTTON2(_s) (_s[3]='2')[m +[31m-#define iupKEYSETBUTTON3(_s) (_s[4]='3')[m +[31m-#define iupKEYSETDOUBLE(_s) (_s[5]='D')[m +[31m-#define iupKEYSETALT(_s) (_s[6]='A')[m +[31m-#define iupKEYSETSYS(_s) (_s[7]='Y')[m +[31m-#define iupKEYSETBUTTON4(_s) (_s[8]='4')[m +[31m-#define iupKEYSETBUTTON5(_s) (_s[9]='5')[m +[32m+[m[32m#define iupKEY_SETSHIFT(_s) (_s[0]='S')[m +[32m+[m[32m#define iupKEY_SETCONTROL(_s) (_s[1]='C')[m +[32m+[m[32m#define iupKEY_SETBUTTON1(_s) (_s[2]='1')[m +[32m+[m[32m#define iupKEY_SETBUTTON2(_s) (_s[3]='2')[m +[32m+[m[32m#define iupKEY_SETBUTTON3(_s) (_s[4]='3')[m +[32m+[m[32m#define iupKEY_SETDOUBLE(_s) (_s[5]='D')[m +[32m+[m[32m#define iupKEY_SETALT(_s) (_s[6]='A')[m +[32m+[m[32m#define iupKEY_SETSYS(_s) (_s[7]='Y')[m +[32m+[m[32m#define iupKEY_SETBUTTON4(_s) (_s[8]='4')[m +[32m+[m[32m#define iupKEY_SETBUTTON5(_s) (_s[9]='5')[m + [m + [m + #ifdef __cplusplus[m +[1mdiff --git a/iup/src/iup_layout.c b/iup/src/iup_layout.c[m +[1mindex b96293c..0ccd496 100755[m +[1m--- a/iup/src/iup_layout.c[m +[1m+++ b/iup/src/iup_layout.c[m +[36m@@ -43,7 +43,7 @@[m [mstatic void iLayoutDisplayUpdateChildren(Ihandle *ih)[m + iLayoutDisplayUpdateChildren(child);[m + [m + if (child->handle && child->iclass->nativetype != IUP_TYPEVOID)[m +[31m- iupdrvDisplayUpdate(child);[m +[32m+[m[32m iupdrvPostRedraw(child);[m + }[m + }[m + [m +[36m@@ -54,7 +54,7 @@[m [mvoid IupUpdate(Ihandle* ih)[m + return;[m + [m + if (ih->handle && ih->iclass->nativetype != IUP_TYPEVOID)[m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + }[m + [m + void IupUpdateChildren(Ihandle* ih)[m +[36m@@ -74,7 +74,7 @@[m [mstatic void iLayoutDisplayRedrawChildren(Ihandle *ih)[m + iLayoutDisplayRedrawChildren(child);[m + [m + if (child->handle && child->iclass->nativetype != IUP_TYPEVOID)[m +[31m- iupdrvDisplayRedraw(child);[m +[32m+[m[32m iupdrvRedrawNow(child);[m + }[m + }[m + [m +[36m@@ -85,7 +85,7 @@[m [mvoid IupRedraw(Ihandle* ih, int children)[m + return;[m + [m + if (ih->handle && ih->iclass->nativetype != IUP_TYPEVOID)[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + [m + if (children)[m + iLayoutDisplayRedrawChildren(ih);[m +[36m@@ -136,7 +136,7 @@[m [mvoid iupLayoutCompute(Ihandle* ih)[m + iupBaseSetPosition(ih, 0, 0);[m + }[m + [m +[31m-static void iLayoutSetMinMaxSize(Ihandle* ih, int *w, int *h)[m +[32m+[m[32mvoid iupLayoutSetMinMaxSize(Ihandle* ih, int *w, int *h)[m + {[m + if (ih->has_minsize)[m + {[m +[36m@@ -163,7 +163,8 @@[m [mvoid iupBaseComputeNaturalSize(Ihandle* ih)[m + ih->naturalwidth = ih->userwidth;[m + ih->naturalheight = ih->userheight;[m + [m +[31m- if (ih->iclass->childtype!=IUP_CHILDNONE || ih->iclass->nativetype == IUP_TYPEDIALOG)[m +[32m+[m[32m if (ih->iclass->childtype!=IUP_CHILDNONE ||[m[41m [m +[32m+[m[32m ih->iclass->nativetype == IUP_TYPEDIALOG) /* pre-defined dialogs can restrict the number of children */[m + {[m + int w=0, h=0, children_expand;[m + [m +[36m@@ -190,7 +191,7 @@[m [mvoid iupBaseComputeNaturalSize(Ihandle* ih)[m + ih->naturalheight = iupMAX(ih->naturalheight, h);[m + [m + /* crop the natural size */[m +[31m- iLayoutSetMinMaxSize(ih, &(ih->naturalwidth), &(ih->naturalheight));[m +[32m+[m[32m iupLayoutSetMinMaxSize(ih, &(ih->naturalwidth), &(ih->naturalheight));[m + }[m + }[m + else [m +[36m@@ -198,15 +199,15 @@[m [mvoid iupBaseComputeNaturalSize(Ihandle* ih)[m + /* for non-container only compute if user size is not defined */[m + if (ih->naturalwidth <= 0 || ih->naturalheight <= 0)[m + {[m +[31m- int w=0, h=0;[m +[31m- iupClassObjectComputeNaturalSize(ih, &w, &h, NULL);[m +[32m+[m[32m int w=0, h=0, children_expand;[m +[32m+[m[32m iupClassObjectComputeNaturalSize(ih, &w, &h, &children_expand);[m + [m + if (ih->naturalwidth <= 0) ih->naturalwidth = w;[m + if (ih->naturalheight <= 0) ih->naturalheight = h;[m + }[m + [m + /* crop the natural size */[m +[31m- iLayoutSetMinMaxSize(ih, &(ih->naturalwidth), &(ih->naturalheight));[m +[32m+[m[32m iupLayoutSetMinMaxSize(ih, &(ih->naturalwidth), &(ih->naturalheight));[m + }[m + }[m + [m +[36m@@ -259,7 +260,7 @@[m [mvoid iupBaseSetCurrentSize(Ihandle* ih, int w, int h, int shrink)[m + [m + /* crop the current size if expanded */[m + if (ih->expand & IUP_EXPAND_WIDTH || ih->expand & IUP_EXPAND_HEIGHT)[m +[31m- iLayoutSetMinMaxSize(ih, &(ih->currentwidth), &(ih->currentheight));[m +[32m+[m[32m iupLayoutSetMinMaxSize(ih, &(ih->currentwidth), &(ih->currentheight));[m + }[m + }[m + [m +[1mdiff --git a/iup/src/iup_layout.h b/iup/src/iup_layout.h[m +[1mindex a2a0c29..775e5a2 100755[m +[1m--- a/iup/src/iup_layout.h[m +[1m+++ b/iup/src/iup_layout.h[m +[36m@@ -16,6 +16,8 @@[m [mextern "C" {[m + void iupLayoutCompute(Ihandle* ih); /* can be called before map */[m + void iupLayoutUpdate(Ihandle* ih); /* called only after map */[m + [m +[32m+[m[32mvoid iupLayoutSetMinMaxSize(Ihandle* ih, int *w, int *h);[m +[32m+[m + /* Other functions declared in <iup.h> and implemented here. [m + IupRefresh[m + */[m +[1mdiff --git a/iup/src/iup_ledlex.c b/iup/src/iup_ledlex.c[m +[1mindex 3283a43..5cf8640 100755[m +[1m--- a/iup/src/iup_ledlex.c[m +[1m+++ b/iup/src/iup_ledlex.c[m +[36m@@ -35,7 +35,7 @@[m [mstatic struct /* lexical variables */[m + static int iLexGetChar (void);[m + static int iLexToken(int *erro);[m + static int iLexCapture (char* dlm);[m +[31m-static int iLexSkip (char* dlm);[m +[32m+[m[32mstatic void iLexSkipComment (void);[m + static int iLexCaptureAttr (void);[m + [m + int iupLexStart(const char* filename, int is_file) /* initialize lexical analysis */[m +[36m@@ -186,9 +186,9 @@[m [mstatic int iLexToken(int *erro)[m + case ']':[m + return IUPLEX_TK_ENDATTR;[m + [m +[31m- case '#': /* iLexSkip comment */[m +[31m- case '%': /* iLexSkip comment */[m +[31m- iLexSkip ("\n\r");[m +[32m+[m[32m case '#': /* Skip comment */[m +[32m+[m[32m case '%': /* Skip comment */[m +[32m+[m[32m iLexSkipComment();[m + continue;[m + [m + case ' ': /* ignore whitespace */[m +[36m@@ -276,14 +276,13 @@[m [mstatic int iLexCaptureAttr (void)[m + return c; /* return delimiter */[m + }[m + [m +[31m-static int iLexSkip (char* dlm)[m +[32m+[m[32mstatic void iLexSkipComment (void)[m + {[m + int c;[m + do[m + {[m +[31m- c = iLexGetChar ();[m +[31m- } while ((c > 0) && !strchr (dlm,c));[m +[31m- return c; /* return delimiter */[m +[32m+[m[32m c = iLexGetChar();[m +[32m+[m[32m } while ((c > 0) && (c != '\n'));[m + }[m + [m + static int iLexGetChar (void)[m +[1mdiff --git a/iup/src/iup_list.c b/iup/src/iup_list.c[m +[1mindex 5965665..1077d98 100755[m +[1m--- a/iup/src/iup_list.c[m +[1m+++ b/iup/src/iup_list.c[m +[36m@@ -53,6 +53,37 @@[m [mstatic void iListCallActionCallback(Ihandle* ih, IFnsii cb, int pos, int state)[m + IupExitLoop();[m + }[m + [m +[32m+[m[32mvoid iupListUpdateOldValue(Ihandle* ih, int pos, int removed)[m +[32m+[m[32m{[m +[32m+[m[32m if (!ih->data->has_editbox)[m +[32m+[m[32m {[m +[32m+[m[32m char* old_value = iupAttribGet(ih, "_IUPLIST_OLDVALUE");[m +[32m+[m[32m if (old_value)[m +[32m+[m[32m {[m +[32m+[m[32m int old_pos = atoi(old_value)-1; /* was in IUP reference, starting at 1 */[m +[32m+[m[32m if (ih->data->is_dropdown || !ih->data->is_multiple)[m +[32m+[m[32m {[m +[32m+[m[32m if (old_pos >= pos)[m +[32m+[m[32m {[m +[32m+[m[32m if (removed && old_pos == pos)[m +[32m+[m[32m {[m +[32m+[m[32m /* when the current item is removed nothing remains selected */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPLIST_OLDVALUE", NULL);[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m iupAttribSetInt(ih, "_IUPLIST_OLDVALUE", removed? old_pos-1: old_pos+1);[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m /* multiple selection on a non drop-down list. */[m +[32m+[m[32m char* value = IupGetAttribute(ih, "VALUE");[m +[32m+[m[32m iupAttribStoreStr(ih, "_IUPLIST_OLDVALUE", value);[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m + void iupListSingleCallActionCallback(Ihandle* ih, IFnsii cb, int pos)[m + {[m + char* old_str = iupAttribGet(ih, "_IUPLIST_OLDVALUE");[m +[36m@@ -77,7 +108,7 @@[m [mvoid iupListMultipleCallActionCallback(Ihandle* ih, IFnsii cb, IFns multi_cb, in[m + char* old_str = iupAttribGet(ih, "_IUPLIST_OLDVALUE");[m + int old_count = old_str? strlen(old_str): 0;[m + [m +[31m- char* str = iupStrGetMemory(count+1);[m +[32m+[m[32m char* str = malloc(count+1);[m + memset(str, '-', count);[m + str[count]=0;[m + for (i=0; i<sel_count; i++)[m +[36m@@ -92,6 +123,7 @@[m [mvoid iupListMultipleCallActionCallback(Ihandle* ih, IFnsii cb, IFns multi_cb, in[m + if (multi_cb)[m + {[m + int unchanged = 1;[m +[32m+[m + for (i=0; i<count && old_str; i++)[m + {[m + if (str[i] == old_str[i])[m +[36m@@ -101,7 +133,10 @@[m [mvoid iupListMultipleCallActionCallback(Ihandle* ih, IFnsii cb, IFns multi_cb, in[m + }[m + [m + if (old_str && unchanged)[m +[32m+[m[32m {[m +[32m+[m[32m free(str);[m + return;[m +[32m+[m[32m }[m + [m + if (multi_cb(ih, str) == IUP_CLOSE)[m + IupExitLoop();[m +[36m@@ -133,6 +168,7 @@[m [mvoid iupListMultipleCallActionCallback(Ihandle* ih, IFnsii cb, IFns multi_cb, in[m + }[m + [m + iupAttribStoreStr(ih, "_IUPLIST_OLDVALUE", str);[m +[32m+[m[32m free(str);[m + }[m + [m + int iupListGetPos(Ihandle* ih, const char* name_id)[m +[36m@@ -145,7 +181,8 @@[m [mint iupListGetPos(Ihandle* ih, const char* name_id)[m + pos--; /* IUP items start at 1 */[m + [m + if (pos < 0) return -1;[m +[31m- if (pos > count-1) return -1;[m +[32m+[m[32m if (pos == count) return -2;[m +[32m+[m[32m if (pos > count) return -1;[m + [m + return pos;[m + }[m +[36m@@ -217,7 +254,10 @@[m [mint iupListSetIdValueAttrib(Ihandle* ih, const char* name_id, const char* value)[m + if (pos >= 0 && pos <= count-1)[m + {[m + if (pos == 0)[m +[32m+[m[32m {[m + iupdrvListRemoveAllItems(ih);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPLIST_OLDVALUE", NULL);[m +[32m+[m[32m }[m + else[m + {[m + int i = pos;[m +[36m@@ -245,7 +285,7 @@[m [mint iupListSetIdValueAttrib(Ihandle* ih, const char* name_id, const char* value)[m + [m + static int iListSetAppendItemAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + if (value)[m + iupdrvListAppendItem(ih, value);[m +[36m@@ -254,27 +294,32 @@[m [mstatic int iListSetAppendItemAttrib(Ihandle* ih, const char* value)[m + [m + static int iListSetInsertItemAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + if (value)[m + {[m + int pos = iupListGetPos(ih, name_id);[m +[31m- if (pos!=-1)[m +[32m+[m[32m if (pos >= 0)[m + iupdrvListInsertItem(ih, pos, value);[m +[32m+[m[32m else if (pos == -2)[m +[32m+[m[32m iupdrvListAppendItem(ih, value);[m + }[m + return 0;[m + }[m + [m + static int iListSetRemoveItemAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + if (!value)[m +[32m+[m[32m {[m + iupdrvListRemoveAllItems(ih);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPLIST_OLDVALUE", NULL);[m +[32m+[m[32m }[m + else[m + {[m + int pos = iupListGetPos(ih, value);[m +[31m- if (pos!=-1)[m +[32m+[m[32m if (pos >= 0)[m + iupdrvListRemoveItem(ih, pos);[m + }[m + return 0;[m +[1mdiff --git a/iup/src/iup_list.h b/iup/src/iup_list.h[m +[1mindex 045116b..05fe9f8 100755[m +[1m--- a/iup/src/iup_list.h[m +[1m+++ b/iup/src/iup_list.h[m +[36m@@ -30,6 +30,7 @@[m [mchar* iupListGetNCAttrib(Ihandle* ih);[m + char* iupListGetPaddingAttrib(Ihandle* ih);[m + char* iupListGetSpacingAttrib(Ihandle* ih);[m + void iupListSingleCallDblClickCallback(Ihandle* ih, IFnis cb, int pos);[m +[32m+[m[32mvoid iupListUpdateOldValue(Ihandle* ih, int pos, int removed);[m + [m + struct _IcontrolData [m + {[m +[1mdiff --git a/iup/src/iup_names.c b/iup/src/iup_names.c[m +[1mindex 9ec01a6..18ca3ef 100755[m +[1m--- a/iup/src/iup_names.c[m +[1m+++ b/iup/src/iup_names.c[m +[36m@@ -14,11 +14,41 @@[m + #include "iup_object.h"[m + #include "iup_class.h"[m + #include "iup_assert.h"[m +[32m+[m[32m#include "iup_attrib.h"[m + #include "iup_str.h"[m + [m + [m + static Itable *inames_strtable = NULL; /* table indexed by name containing Ihandle* address */[m +[31m-static Itable *inames_ihtable = NULL; /* table indexed by Ihandle* address containing names */[m +[32m+[m +[32m+[m[32mvoid iupNamesInit(void)[m +[32m+[m[32m{[m +[32m+[m[32m inames_strtable = iupTableCreate(IUPTABLE_STRINGINDEXED);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupNamesFinish(void)[m +[32m+[m[32m{[m +[32m+[m[32m iupTableDestroy(inames_strtable);[m +[32m+[m[32m inames_strtable = NULL;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic Ihandle* iNameGetTopParent(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m Ihandle* parent = ih;[m +[32m+[m[32m while (parent->parent)[m +[32m+[m[32m parent = parent->parent;[m +[32m+[m[32m return parent;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic int iNameCheckArray(Ihandle** ih_array, int count, Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m int i;[m +[32m+[m[32m for (i = 0; i < count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (ih_array[i] == ih)[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m[32m return 1;[m +[32m+[m[32m}[m + [m + void iupNamesDestroyHandles(void)[m + {[m +[36m@@ -37,10 +67,14 @@[m [mvoid iupNamesDestroyHandles(void)[m + while (name)[m + {[m + ih = (Ihandle*)iupTableGetCurr(inames_strtable);[m +[31m- if (iupObjectCheck(ih))[m +[32m+[m[32m if (iupObjectCheck(ih)) /* here must be a handle */[m + {[m +[31m- ih_array[i] = ih;[m +[31m- i++;[m +[32m+[m[32m ih = iNameGetTopParent(ih);[m +[32m+[m[32m if (iNameCheckArray(ih_array, i, ih))[m +[32m+[m[32m {[m +[32m+[m[32m ih_array[i] = ih;[m +[32m+[m[32m i++;[m +[32m+[m[32m }[m + }[m + name = iupTableNext(inames_strtable);[m + }[m +[36m@@ -48,44 +82,28 @@[m [mvoid iupNamesDestroyHandles(void)[m + count = i;[m + for (i = 0; i < count; i++)[m + {[m +[31m- if (iupObjectCheck(ih_array[i]))[m +[32m+[m[32m if (iupObjectCheck(ih_array[i])) /* here must be a handle */[m + IupDestroy(ih_array[i]);[m + }[m + [m + free(ih_array);[m + }[m + [m +[31m-void iupNamesInit(void)[m +[31m-{[m +[31m- inames_strtable = iupTableCreate(IUPTABLE_STRINGINDEXED);[m +[31m- inames_ihtable = iupTableCreate(IUPTABLE_POINTERINDEXED);[m +[31m-}[m +[31m-[m +[31m-void iupNamesFinish(void)[m +[31m-{[m +[31m- iupTableDestroy(inames_strtable);[m +[31m- inames_strtable = NULL;[m +[31m-[m +[31m- iupTableDestroy(inames_ihtable);[m +[31m- inames_ihtable = NULL;[m +[31m-}[m +[31m-[m +[31m-void iupRemoveAllNames(Ihandle* ih)[m +[32m+[m[32mvoid iupRemoveNames(Ihandle* ih)[m + {[m + char *name;[m +[31m- Ihandle *cur_ih;[m + [m +[31m- name = iupTableFirst(inames_strtable);[m +[31m- while (name)[m +[31m- {[m +[31m- cur_ih = (Ihandle*)iupTableGetCurr(inames_strtable);[m +[31m- if (iupObjectCheck(cur_ih) && cur_ih == ih)[m +[31m- iupTableRemoveCurr(inames_strtable);[m +[32m+[m[32m /* clear the cache */[m +[32m+[m[32m name = iupAttribGet(ih, "_IUP_LASTHANDLENAME");[m +[32m+[m[32m if (name)[m +[32m+[m[32m iupTableRemove(inames_strtable, name);[m + [m +[31m- name = iupTableNext(inames_strtable);[m +[31m- }[m +[32m+[m[32m /* check for an internal name */[m +[32m+[m[32m name = iupAttribGetHandleName(ih);[m +[32m+[m[32m if (name)[m +[32m+[m[32m iupTableRemove(inames_strtable, name);[m + [m +[31m- iupTableRemove(inames_ihtable, (char*)ih);[m +[32m+[m[32m /* Do NOT search for other names */[m + }[m + [m + Ihandle *IupGetHandle(const char *name)[m +[36m@@ -104,22 +122,24 @@[m [mIhandle* IupSetHandle(const char *name, Ihandle *ih)[m + return NULL;[m + [m + old_ih = iupTableGet(inames_strtable, name);[m +[32m+[m + if (ih != NULL)[m + {[m + iupTableSet(inames_strtable, name, ih, IUPTABLE_POINTER);[m +[31m- iupTableSet(inames_ihtable, (char*)ih, (char*)name, IUPTABLE_STRING); /* keep only the last name set */[m +[32m+[m +[32m+[m[32m /* save the name in the cache if it is a valid handle */[m +[32m+[m[32m if (iupObjectCheck(ih))[m +[32m+[m[32m iupAttribStoreStr(ih, "_IUP_LASTHANDLENAME", name);[m + }[m + else[m + {[m +[31m- ih = iupTableGet(inames_strtable, name);[m + iupTableRemove(inames_strtable, name);[m +[31m- if (ih) [m +[31m- {[m +[31m- char* cur_name = iupTableGet(inames_ihtable, (char*)ih);[m +[31m- if (iupStrEqualNoCase(cur_name, name))[m +[31m- iupTableRemove(inames_ihtable, (char*)ih);[m +[31m- }[m +[32m+[m +[32m+[m[32m /* clear the name from the cache if it is a valid handle */[m +[32m+[m[32m if (iupObjectCheck(old_ih))[m +[32m+[m[32m iupAttribSetStr(old_ih, "_IUP_LASTHANDLENAME", NULL);[m + }[m +[32m+[m + return old_ih;[m + }[m + [m +[36m@@ -151,7 +171,8 @@[m [mstatic int iNamesCountDialogs(void)[m + while (name)[m + {[m + Ihandle* dlg = (Ihandle*)iupTableGetCurr(inames_strtable);[m +[31m- if (iupObjectCheck(dlg) && dlg->iclass->nativetype == IUP_TYPEDIALOG)[m +[32m+[m[32m if (iupObjectCheck(dlg) && /* here must be a handle */[m +[32m+[m[32m dlg->iclass->nativetype == IUP_TYPEDIALOG)[m + i++;[m + [m + name = iupTableNext(inames_strtable);[m +[36m@@ -171,7 +192,8 @@[m [mint IupGetAllDialogs(char** names, int n)[m + while (name)[m + {[m + Ihandle* dlg = (Ihandle*)iupTableGetCurr(inames_strtable);[m +[31m- if (iupObjectCheck(dlg) && dlg->iclass->nativetype == IUP_TYPEDIALOG)[m +[32m+[m[32m if (iupObjectCheck(dlg) && /* here must be a handle */[m +[32m+[m[32m dlg->iclass->nativetype == IUP_TYPEDIALOG)[m + {[m + names[i] = name;[m + i++;[m +[36m@@ -186,8 +208,32 @@[m [mint IupGetAllDialogs(char** names, int n)[m + [m + char* IupGetName(Ihandle* ih)[m + {[m +[31m- iupASSERT(iupObjectCheck(ih));[m +[31m- if (!iupObjectCheck(ih))[m +[32m+[m[32m char *name;[m +[32m+[m[32m if (!ih) /* no iupASSERT needed here */[m + return NULL;[m +[31m- return iupTableGet(inames_ihtable, (char*)ih);[m +[32m+[m +[32m+[m[32m if (iupObjectCheck(ih))[m +[32m+[m[32m {[m +[32m+[m[32m /* check the cache first, but must be a handle */[m +[32m+[m[32m name = iupAttribGet(ih, "_IUP_LASTHANDLENAME");[m +[32m+[m[32m if (name)[m +[32m+[m[32m return name;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m /* check for an internal name */[m +[32m+[m[32m name = iupAttribGetHandleName(ih);[m +[32m+[m[32m if (name)[m +[32m+[m[32m return name;[m +[32m+[m[41m [m +[32m+[m[32m /* search for the name */[m +[32m+[m[32m name = iupTableFirst(inames_strtable);[m +[32m+[m[32m while (name)[m +[32m+[m[32m {[m +[32m+[m[32m if ((Ihandle*)iupTableGetCurr(inames_strtable) == ih)[m +[32m+[m[32m return name;[m +[32m+[m +[32m+[m[32m name = iupTableNext(inames_strtable);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m return NULL;[m + }[m +[1mdiff --git a/iup/src/iup_names.h b/iup/src/iup_names.h[m +[1mindex 9d3adc7..d652594 100755[m +[1m--- a/iup/src/iup_names.h[m +[1m+++ b/iup/src/iup_names.h[m +[36m@@ -17,7 +17,7 @@[m [mvoid iupNamesFinish(void);[m + void iupNamesDestroyHandles(void);[m + [m + /* called from IupDestroy */[m +[31m-void iupRemoveAllNames(Ihandle* ih);[m +[32m+[m[32mvoid iupRemoveNames(Ihandle* ih);[m + [m + /* Other functions declared in <iup.h> and implemented here.[m + IupGetName[m +[1mdiff --git a/iup/src/iup_object.c b/iup/src/iup_object.c[m +[1mindex 7f4ce23..f0d5dc9 100755[m +[1m--- a/iup/src/iup_object.c[m +[1m+++ b/iup/src/iup_object.c[m +[36m@@ -148,6 +148,8 @@[m [mIhandle* IupCreate(const char *name)[m + [m + void IupDestroy(Ihandle *ih)[m + {[m +[32m+[m[32m Icallback cb;[m +[32m+[m + iupASSERT(iupObjectCheck(ih));[m + if (!iupObjectCheck(ih))[m + return;[m +[36m@@ -156,6 +158,9 @@[m [mvoid IupDestroy(Ihandle *ih)[m + if (ih->iclass->nativetype == IUP_TYPEDIALOG)[m + IupHide(ih);[m + [m +[32m+[m[32m cb = IupGetCallback(ih, "DESTROY_CB");[m +[32m+[m[32m if (cb) cb(ih);[m +[32m+[m + /* Destroy all its children.[m + Just need to remove the first child,[m + IupDetach will update firstchild. */[m +[36m@@ -165,6 +170,9 @@[m [mvoid IupDestroy(Ihandle *ih)[m + /* unmap if mapped and remove from its parent child list */[m + IupDetach(ih);[m + [m +[32m+[m[32m /* removes names associated with the element */[m +[32m+[m[32m iupRemoveNames(ih);[m +[32m+[m + /* destroy the element */[m + iupClassObjectDestroy(ih);[m + [m +[36m@@ -172,9 +180,6 @@[m [mvoid IupDestroy(Ihandle *ih)[m + if (ih->data)[m + free(ih->data);[m + [m +[31m- /* removes all the names associated with the element */[m +[31m- iupRemoveAllNames(ih);[m +[31m-[m + /* destroy the base handle structure */[m + iHandleDestroy(ih);[m + }[m +[1mdiff --git a/iup/src/iup_object.h b/iup/src/iup_object.h[m +[1mindex 6f6b668..a69edc0 100755[m +[1m--- a/iup/src/iup_object.h[m +[1m+++ b/iup/src/iup_object.h[m +[36m@@ -113,6 +113,7 @@[m [mIhandle* iupObjectCreate(Iclass* ic, void** params);[m + void** iupObjectGetParamList(void* first, va_list arglist);[m + [m + /** Checks if the handle is still valid based on the signature.[m +[32m+[m[32m * But if the handle was destroyed still can access invalid memory.[m + * \ingroup object */[m + int iupObjectCheck(Ihandle* ih);[m + [m +[1mdiff --git a/iup/src/iup_open.c b/iup/src/iup_open.c[m +[1mindex e02561e..bce5c5c 100755[m +[1m--- a/iup/src/iup_open.c[m +[1m+++ b/iup/src/iup_open.c[m +[36m@@ -101,8 +101,8 @@[m [mvoid IupClose(void)[m + [m + iupdrvSetIdleFunction(NULL); /* stop any idle */[m + [m +[31m- iupDlgListDestroyAll(); /* destroy all dialogs */[m +[31m- iupNamesDestroyHandles(); /* destroy everything else that have names */[m +[32m+[m[32m iupDlgListDestroyAll(); /* destroy all dialogs and their children */[m +[32m+[m[32m iupNamesDestroyHandles(); /* destroy everything that do not belong to a dialog */[m + iupImageStockFinish(); /* release stock images hash table and the images */[m + [m + iupRegisterFinish(); /* release native classes */[m +[1mdiff --git a/iup/src/iup_register.c b/iup/src/iup_register.c[m +[1mindex 4c58038..2e9954a 100755[m +[1m--- a/iup/src/iup_register.c[m +[1m+++ b/iup/src/iup_register.c[m +[36m@@ -99,6 +99,7 @@[m [mvoid iupRegisterInternalClasses(void)[m + iupRegisterClass(iupCboxGetClass());[m + iupRegisterClass(iupSboxGetClass());[m + iupRegisterClass(iupNormalizerGetClass());[m +[32m+[m[32m iupRegisterClass(iupSplitGetClass());[m + [m + iupRegisterClass(iupMenuGetClass());[m + iupRegisterClass(iupItemGetClass());[m +[1mdiff --git a/iup/src/iup_sbox.c b/iup/src/iup_sbox.c[m +[1mindex 5a71d33..9998481 100755[m +[1m--- a/iup/src/iup_sbox.c[m +[1m+++ b/iup/src/iup_sbox.c[m +[36m@@ -57,6 +57,7 @@[m [mstatic void iSboxSaveDimension(Ihandle* ih, int w, int h)[m + {[m + ih->data->w = w;[m + ih->data->h = h;[m +[32m+[m[32m iupLayoutSetMinMaxSize(ih, &(ih->data->w), &(ih->data->h));[m + }[m + [m + static void iSboxAddDecorOffset(Ihandle* ih, int *x, int *y)[m +[1mdiff --git a/iup/src/iup_show.c b/iup/src/iup_show.c[m +[1mindex 9ea1408..b42975e 100755[m +[1m--- a/iup/src/iup_show.c[m +[1m+++ b/iup/src/iup_show.c[m +[36m@@ -53,35 +53,6 @@[m [mvoid IupUnmap(Ihandle *ih)[m + ih->handle = NULL;[m + }[m + [m +[31m-static char* iShowGetVisible(Ihandle* ih)[m +[31m-{[m +[31m- char* value = iupAttribGet(ih, "VISIBLE"); /* Check on the element first */[m +[31m- while (!value)[m +[31m- {[m +[31m- ih = ih->parent; /* iheritance here independs on the attribute */[m +[31m- if (!ih)[m +[31m- return NULL;[m +[31m-[m +[31m- value = iupAttribGet(ih, "VISIBLE");[m +[31m-[m +[31m- /* only recursive up to the native parent */ [m +[31m- if (ih->iclass->nativetype != IUP_TYPEVOID)[m +[31m- return value; /* can be NULL */[m +[31m- }[m +[31m-[m +[31m- return value;[m +[31m-}[m +[31m-[m +[31m-static void iShowUpdateVisible(Ihandle* ih)[m +[31m-{[m +[31m- int inherit;[m +[31m- /* although default is VISIBLE=YES, [m +[31m- when mapped the element is still hidden. [m +[31m- So we must manually update the visible state. */[m +[31m- char* value = iShowGetVisible(ih);[m +[31m- iupClassObjectSetAttribute(ih, "VISIBLE", value, &inherit);[m +[31m-}[m +[31m-[m + int IupMap(Ihandle* ih)[m + {[m + iupASSERT(iupObjectCheck(ih));[m +[36m@@ -108,7 +79,7 @@[m [mint IupMap(Ihandle* ih)[m + return IUP_ERROR;[m + }[m + [m +[31m- /* update FONT, must be the before several others */[m +[32m+[m[32m /* update FONT, must be the before several others, so we do it here */[m + if (ih->iclass->nativetype != IUP_TYPEVOID &&[m + ih->iclass->nativetype != IUP_TYPEIMAGE &&[m + ih->iclass->nativetype != IUP_TYPEMENU)[m +[36m@@ -117,18 +88,13 @@[m [mint IupMap(Ihandle* ih)[m + /* ensure attributes default values, at this time only the ones that need to be set after map */[m + iupClassObjectEnsureDefaultAttributes(ih);[m + [m +[31m- /* check visible state if not a dialog */[m +[31m- if (ih->iclass->nativetype == IUP_TYPECANVAS || [m +[31m- ih->iclass->nativetype == IUP_TYPECONTROL)[m +[31m- iShowUpdateVisible(ih);[m +[31m-[m +[31m- /* updates the defined attributes in the native system. */[m +[32m+[m[32m /* updates the defined attributes from the hash table to the native system. */[m + iupAttribUpdate(ih); [m + [m +[31m- /* updates attributes defined in the parent tree */[m +[32m+[m[32m /* updates inheritable attributes defined in the parent tree */[m + iupAttribUpdateFromParent(ih);[m + [m +[31m- /* map children */[m +[32m+[m[32m /* map children independent from childtype */[m + {[m + Ihandle* child = ih->firstchild;[m + while (child)[m +[36m@@ -140,6 +106,10 @@[m [mint IupMap(Ihandle* ih)[m + }[m + }[m + [m +[32m+[m[32m /* updates the defined attributes from the hash table to the native system. */[m +[32m+[m[32m if (ih->iclass->childtype!=IUP_CHILDNONE)[m +[32m+[m[32m iupAttribUpdateChildren(ih);[m +[32m+[m + /* moves and resizes the elements to reflect the layout computation */[m + /* if the dialog is visible will be reflected in the user interface */[m + if (ih->iclass->nativetype == IUP_TYPEDIALOG)[m +[1mdiff --git a/iup/src/iup_spin.c b/iup/src/iup_spin.c[m +[1mindex 6fadab4..514703f 100755[m +[1m--- a/iup/src/iup_spin.c[m +[1m+++ b/iup/src/iup_spin.c[m +[36m@@ -175,7 +175,7 @@[m [mstatic int iSpinCreateMethod(Ihandle* ih, void** params)[m + [m + static int iSpinboxCreateMethod(Ihandle* ih, void** params)[m + {[m +[31m- Ihandle *spin, *ctrl;[m +[32m+[m[32m Ihandle *spin;[m + [m + if (!params || !(params[0]))[m + return IUP_ERROR;[m +[36m@@ -184,8 +184,7 @@[m [mstatic int iSpinboxCreateMethod(Ihandle* ih, void** params)[m + IupSetAttribute(ih, "MARGIN", "0x0");[m + IupSetAttribute(ih, "ALIGNMENT", "ACENTER");[m + [m +[31m- ctrl = (Ihandle*)(params[0]);[m +[31m- iupChildTreeAppend(ih, ctrl);[m +[32m+[m[32m /* IupText is already a child of Spinbox because of the IupHbox Create method */[m + [m + spin = IupSpin();[m + iupChildTreeAppend(ih, spin);[m +[36m@@ -249,7 +248,7 @@[m [mIclass* iupSpinboxGetClass(void)[m + ic->name = "spinbox";[m + ic->format = "h"; /* one Ihandle */[m + ic->nativetype = IUP_TYPEVOID;[m +[31m- ic->childtype = IUP_CHILDNONE;[m +[32m+[m[32m ic->childtype = IUP_CHILD_ONE; /* fake value to define it as a container */[m + ic->is_interactive = 0;[m + [m + iupClassRegisterCallback(ic, "SPIN_CB", "i");[m +[36m@@ -267,7 +266,7 @@[m [mIclass* iupSpinGetClass(void)[m + ic->name = "spin";[m + ic->format = NULL; /* no parameters */[m + ic->nativetype = IUP_TYPEVOID;[m +[31m- ic->childtype = IUP_CHILDNONE;[m +[32m+[m[32m ic->childtype = IUP_CHILD_ONE; /* fake value to define it as a container */[m + ic->is_interactive = 0;[m + [m + /* Class functions */[m +[1mdiff --git a/iup/src/iup_stdcontrols.h b/iup/src/iup_stdcontrols.h[m +[1mindex 11499ae..0f3deb9 100755[m +[1m--- a/iup/src/iup_stdcontrols.h[m +[1m+++ b/iup/src/iup_stdcontrols.h[m +[36m@@ -46,6 +46,7 @@[m [mIclass* iupZboxGetClass(void);[m + Iclass* iupCboxGetClass(void);[m + Iclass* iupSboxGetClass(void);[m + Iclass* iupNormalizerGetClass(void);[m +[32m+[m[32mIclass* iupSplitGetClass(void);[m + [m + Iclass* iupTimerGetClass(void);[m + Iclass* iupImageGetClass(void);[m +[1mdiff --git a/iup/src/iup_str.c b/iup/src/iup_str.c[m +[1mindex 68976f1..5f5b85d 100755[m +[1m--- a/iup/src/iup_str.c[m +[1m+++ b/iup/src/iup_str.c[m +[36m@@ -147,8 +147,9 @@[m [mchar *iupStrCopyUntil(char **str, int c)[m + return NULL;[m + [m + p_str=strchr(*str,c);[m +[31m- if (!p_str) return NULL;[m +[31m-[m +[32m+[m[32m if (!p_str)[m[41m [m +[32m+[m[32m return NULL;[m +[32m+[m[32m else[m + {[m + int i;[m + int sl=(int)(p_str - (*str));[m +[36m@@ -160,10 +161,10 @@[m [mchar *iupStrCopyUntil(char **str, int c)[m + new_str[i] = (*str)[i];[m + [m + new_str[sl] = 0;[m +[31m- }[m + [m +[31m- *str = p_str+1;[m +[31m- return new_str;[m +[32m+[m[32m *str = p_str+1;[m +[32m+[m[32m return new_str;[m +[32m+[m[32m }[m + }[m + [m + char *iupStrCopyUntilNoCase(char **str, int c)[m +[36m@@ -174,11 +175,12 @@[m [mchar *iupStrCopyUntilNoCase(char **str, int c)[m + [m + p_str=strchr(*str,c); /* usually the lower case is enough */[m + if (!p_str && isalpha(c)) [m +[31m- {[m + p_str=strchr(*str, toupper(c)); /* but check also for upper case */[m +[31m- if (!p_str) return NULL;[m +[31m- }[m + [m +[32m+[m[32m /* if both fail, then abort */[m +[32m+[m[32m if (!p_str)[m[41m [m +[32m+[m[32m return NULL;[m +[32m+[m[32m else[m + {[m + int i;[m + int sl=(int)(p_str - (*str));[m +[36m@@ -190,10 +192,10 @@[m [mchar *iupStrCopyUntilNoCase(char **str, int c)[m + new_str[i] = (*str)[i];[m + [m + new_str[sl] = 0;[m +[31m- }[m + [m +[31m- *str = p_str+1;[m +[31m- return new_str;[m +[32m+[m[32m *str = p_str+1;[m +[32m+[m[32m return new_str;[m +[32m+[m[32m }[m + }[m + [m + char *iupStrGetMemory(int size)[m +[1mdiff --git a/iup/src/iup_table.c b/iup/src/iup_table.c[m +[1mindex 9e97ff5..a873191 100755[m +[1m--- a/iup/src/iup_table.c[m +[1m+++ b/iup/src/iup_table.c[m +[36m@@ -19,12 +19,12 @@[m + /* Adjust these parameters for optimal performance and memory usage */[m + static const unsigned int itable_maxTableSizeIndex = 8;[m + static const unsigned int itable_hashTableSize[] = { 31, 101, 401, 1601, 4001, 8009, 16001, 32003, 64007 };[m +[31m-static const float itable_resizeLimit = 2;[m +[32m+[m[32mstatic const unsigned int itable_resizeLimit = 2;[m + static const unsigned int itable_itemGrow = 5;[m + [m + /* Iteration context.[m + */[m +[31m-typedef struct ItableContext[m +[32m+[m[32mtypedef struct _ItableContext[m + {[m + unsigned int entryIndex; /* index at the Itable::entries array */[m + unsigned int itemIndex; /* index at the ItableEntry::items array */[m +[36m@@ -41,7 +41,7 @@[m [mtypedef struct ItableContext[m + * this is simply the pointer (in this case keyIndex[m + * and keyStr are equal).[m + */[m +[31m-typedef struct ItableKey[m +[32m+[m[32mtypedef struct _ItableKey[m + {[m + unsigned long keyIndex; /* the secondary hash number */[m + const char *keyStr;[m +[36m@@ -52,11 +52,11 @@[m [mItableKey;[m + * Such an item is stored in the item list of[m + * an entry.[m + */[m +[31m-typedef struct ItableItem[m +[32m+[m[32mtypedef struct _ItableItem[m + {[m + Itable_Types itemType;[m +[31m- ItableKey key;[m +[31m- void *value;[m +[32m+[m[32m ItableKey key;[m +[32m+[m[32m void* value;[m + }[m + ItableItem;[m + [m +[36m@@ -67,29 +67,28 @@[m [mItableItem;[m + * in nextItemIndex.[m + * size is the current size of the items array.[m + */[m +[31m-typedef struct ItableEntry[m +[32m+[m[32mtypedef struct _ItableEntry[m + {[m + unsigned int nextItemIndex;[m +[31m- unsigned int size;[m +[31m- ItableItem *items;[m +[32m+[m[32m unsigned int itemsSize;[m +[32m+[m[32m ItableItem* items;[m + }[m + ItableEntry;[m + [m + [m + /* A hash table.[m +[31m- * indexType is the type of the index.[m + * entries is an array of entries. Select an[m + * entry by its index.[m + * size is the number of entries in the hash table...[m + */[m +[31m-struct Itable[m +[32m+[m[32mstruct _Itable[m + {[m +[31m- unsigned int size;[m +[31m- unsigned int numberOfEntries;[m +[31m- unsigned int tableSizeIndex; /* index into itable_hashTableSize array */[m +[31m- Itable_IndexTypes indexType;[m +[31m- ItableEntry *entries;[m +[31m- ItableContext context;[m +[32m+[m[32m unsigned int entriesSize;[m +[32m+[m[32m unsigned int numberOfEntries;[m +[32m+[m[32m unsigned int tableSizeIndex; /* index into itable_hashTableSize array */[m +[32m+[m[32m Itable_IndexTypes indexType; /* type of the index: string or pointer. */[m +[32m+[m[32m ItableEntry *entries;[m +[32m+[m[32m ItableContext context;[m + };[m + [m + [m +[36m@@ -121,8 +120,7 @@[m [mItable *iupTableCreate(Itable_IndexTypes indexType)[m + [m + Itable *iupTableCreateSized(Itable_IndexTypes indexType, unsigned int initialSizeIndex)[m + {[m +[31m- Itable *it = (Itable *)malloc(sizeof(struct Itable));[m +[31m-[m +[32m+[m[32m Itable *it = (Itable *)malloc(sizeof(Itable));[m + iupASSERT(it!=NULL);[m + if (!it)[m + return 0;[m +[36m@@ -130,12 +128,12 @@[m [mItable *iupTableCreateSized(Itable_IndexTypes indexType, unsigned int initialSiz[m + if (initialSizeIndex > itable_maxTableSizeIndex)[m + initialSizeIndex = itable_maxTableSizeIndex;[m + [m +[31m- it->size = itable_hashTableSize[initialSizeIndex];[m +[32m+[m[32m it->entriesSize = itable_hashTableSize[initialSizeIndex];[m + it->tableSizeIndex = initialSizeIndex;[m + it->numberOfEntries = 0;[m + it->indexType = indexType;[m + [m +[31m- it->entries = (ItableEntry *)malloc(it->size * sizeof(ItableEntry));[m +[32m+[m[32m it->entries = (ItableEntry *)malloc(it->entriesSize * sizeof(ItableEntry));[m + iupASSERT(it->entries!=NULL);[m + if (!it->entries)[m + {[m +[36m@@ -143,7 +141,7 @@[m [mItable *iupTableCreateSized(Itable_IndexTypes indexType, unsigned int initialSiz[m + return 0;[m + }[m + [m +[31m- memset(it->entries, 0, it->size * sizeof(ItableEntry));[m +[32m+[m[32m memset(it->entries, 0, it->entriesSize * sizeof(ItableEntry));[m + [m + it->context.entryIndex = (unsigned int)-1;[m + it->context.itemIndex = (unsigned int)-1;[m +[36m@@ -158,16 +156,19 @@[m [mvoid iupTableClear(Itable *it)[m + if (!it)[m + return;[m + [m +[31m- for (i = 0; i < it->size; i++)[m +[32m+[m[32m for (i = 0; i < it->entriesSize; i++)[m + {[m + ItableEntry *entry = &(it->entries[i]);[m + if (entry->items)[m +[32m+[m[32m {[m + iTableFreeItemArray(it->indexType, entry->nextItemIndex, entry->items);[m +[32m+[m[32m entry->items = NULL;[m +[32m+[m[32m }[m + }[m + [m + it->numberOfEntries = 0;[m + [m +[31m- memset(it->entries, 0, it->size * sizeof(ItableEntry));[m +[32m+[m[32m memset(it->entries, 0, it->entriesSize * sizeof(ItableEntry));[m + [m + it->context.entryIndex = (unsigned int)-1;[m + it->context.itemIndex = (unsigned int)-1;[m +[36m@@ -185,7 +186,10 @@[m [mvoid iupTableDestroy(Itable *it)[m + iupTableClear(it);[m + [m + if (it->entries)[m +[32m+[m[32m {[m + free(it->entries);[m +[32m+[m[32m it->entries = NULL;[m +[32m+[m[32m }[m + [m + free(it);[m + }[m +[36m@@ -288,17 +292,23 @@[m [mstatic void iTableRemoveItem(Itable *it, ItableEntry *entry, unsigned int itemIn[m + item = &(entry->items[itemIndex]);[m + [m + if (it->indexType == IUPTABLE_STRINGINDEXED)[m +[32m+[m[32m {[m + free((void *)item->key.keyStr);[m +[32m+[m[32m item->key.keyStr = NULL;[m +[32m+[m[32m }[m + [m + if (item->itemType == IUPTABLE_STRING)[m +[32m+[m[32m {[m + free(item->value);[m +[32m+[m[32m item->value = NULL;[m +[32m+[m[32m }[m + [m +[31m- /* order the remaining items */[m +[32m+[m[32m /* re-order the remaining items */[m + for (i = itemIndex; i < entry->nextItemIndex-1; i++)[m + entry->items[i] = entry->items[i+1];[m + [m +[31m- /* clear the non used item */[m +[31m- memset(entry->items + entry->nextItemIndex, 0, sizeof (ItableItem));[m +[32m+[m[32m /* clear the released item */[m +[32m+[m[32m memset(entry->items + entry->nextItemIndex-1, 0, sizeof (ItableItem));[m + [m + entry->nextItemIndex--;[m + it->numberOfEntries--;[m +[36m@@ -398,7 +408,7 @@[m [mchar *iupTableFirst(Itable *it)[m + it->context.itemIndex = (unsigned int)-1;[m + [m + /* find the first used entry */[m +[31m- for (entryIndex = 0; entryIndex < it->size; entryIndex++)[m +[32m+[m[32m for (entryIndex = 0; entryIndex < it->entriesSize; entryIndex++)[m + {[m + if (it->entries[entryIndex].nextItemIndex > 0)[m + {[m +[36m@@ -430,7 +440,7 @@[m [mchar *iupTableNext(Itable *it)[m + else[m + {[m + /* find the next used entry */[m +[31m- for (entryIndex = it->context.entryIndex+1; entryIndex < it->size; entryIndex++)[m +[32m+[m[32m for (entryIndex = it->context.entryIndex+1; entryIndex < it->entriesSize; entryIndex++)[m + {[m + if (it->entries[entryIndex].nextItemIndex > 0)[m + {[m +[36m@@ -471,7 +481,7 @@[m [mchar *iupTableRemoveCurr(Itable *it)[m + else[m + {[m + /* find the next used entry */[m +[31m- for (entryIndex = it->context.entryIndex+1; entryIndex < it->size; entryIndex++)[m +[32m+[m[32m for (entryIndex = it->context.entryIndex+1; entryIndex < it->entriesSize; entryIndex++)[m + {[m + if (it->entries[entryIndex].nextItemIndex > 0)[m + {[m +[36m@@ -498,6 +508,8 @@[m [mstatic void iTableFreeItemArray(Itable_IndexTypes indexType, unsigned int nextFr[m + {[m + unsigned int i;[m + [m +[32m+[m[32m /* Used only in iupTableClear */[m +[32m+[m + iupASSERT(items!=NULL);[m + if (!items)[m + return;[m +[36m@@ -505,13 +517,19 @@[m [mstatic void iTableFreeItemArray(Itable_IndexTypes indexType, unsigned int nextFr[m + if (indexType == IUPTABLE_STRINGINDEXED)[m + {[m + for (i = 0; i < nextFreeIndex; i++)[m +[32m+[m[32m {[m + free((void *)(items[i].key.keyStr));[m +[32m+[m[32m items[i].key.keyStr = NULL;[m +[32m+[m[32m }[m + }[m + [m + for (i = 0; i < nextFreeIndex; i++)[m + {[m + if (items[i].itemType == IUPTABLE_STRING)[m +[32m+[m[32m {[m + free(items[i].value);[m +[32m+[m[32m items[i].value = NULL;[m +[32m+[m[32m }[m + }[m + [m + free(items);[m +[36m@@ -545,7 +563,7 @@[m [mstatic unsigned int iTableGetEntryIndex(Itable *it, const char *key, unsigned lo[m + *keyIndex = (unsigned long)key; /* this could NOT be dependent from table size */[m + }[m + [m +[31m- return (unsigned int)((*keyIndex) % it->size);[m +[32m+[m[32m return (unsigned int)((*keyIndex) % it->entriesSize);[m + }[m + [m + #ifdef DEBUGTABLE[m +[36m@@ -603,25 +621,24 @@[m [mstatic unsigned int iTableFindItem(Itable *it, const char *key, ItableEntry **en[m + [m + static void iTableUpdateArraySize(ItableEntry *entry)[m + {[m +[31m- if (entry->nextItemIndex >= entry->size)[m +[32m+[m[32m if (entry->nextItemIndex >= entry->itemsSize)[m + {[m + /* we have to expand the item array */[m + unsigned int newSize;[m + [m +[31m- newSize = entry->size + itable_itemGrow;[m +[32m+[m[32m newSize = entry->itemsSize + itable_itemGrow;[m + [m + entry->items = (ItableItem *)realloc(entry->items, newSize * sizeof(ItableItem));[m + iupASSERT(entry->items!=NULL);[m + if (!entry->items)[m + return;[m + [m +[31m- memset(entry->items + entry->size, 0, itable_itemGrow * sizeof(ItableItem));[m +[32m+[m[32m memset(entry->items + entry->itemsSize, 0, itable_itemGrow * sizeof(ItableItem));[m + [m +[31m- entry->size = newSize;[m +[32m+[m[32m entry->itemsSize = newSize;[m + }[m + }[m + [m +[31m-[m + static void iTableAdd(Itable *it, ItableKey *key, void *value, Itable_Types itemType)[m + {[m + unsigned int entryIndex;[m +[36m@@ -657,7 +674,7 @@[m [mstatic unsigned int iTableResize(Itable *it)[m + /* check if we do not need to resize the hash table */[m + if (it->numberOfEntries == 0 ||[m + it->tableSizeIndex >= itable_maxTableSizeIndex ||[m +[31m- it->size / it->numberOfEntries >= itable_resizeLimit)[m +[32m+[m[32m it->entriesSize / it->numberOfEntries >= itable_resizeLimit)[m + return 0;[m + [m + /* create a new hash table and copy the contents of[m +[36m@@ -666,7 +683,7 @@[m [mstatic unsigned int iTableResize(Itable *it)[m + newSizeIndex = it->tableSizeIndex + 1;[m + newTable = iupTableCreateSized(it->indexType, newSizeIndex);[m + [m +[31m- for (entryIndex = 0; entryIndex < it->size; entryIndex++)[m +[32m+[m[32m for (entryIndex = 0; entryIndex < it->entriesSize; entryIndex++)[m + {[m + entry = &(it->entries[entryIndex]);[m + [m +[36m@@ -680,12 +697,13 @@[m [mstatic unsigned int iTableResize(Itable *it)[m + } [m + [m + free(entry->items);[m +[32m+[m[32m entry->items = NULL;[m + }[m + }[m + [m + free(it->entries);[m + [m +[31m- it->size = newTable->size;[m +[32m+[m[32m it->entriesSize = newTable->entriesSize;[m + it->tableSizeIndex = newTable->tableSizeIndex;[m + it->numberOfEntries = newTable->numberOfEntries;[m + it->entries = newTable->entries;[m +[36m@@ -712,11 +730,11 @@[m [mstatic void iTableShowStatistics(Itable *it)[m + return;[m + }[m + [m +[31m- nofSlots = it->size;[m +[32m+[m[32m nofSlots = it->entriesSize;[m + nofKeys = it->numberOfEntries;[m + optimalNofKeysPerSlot = (double)nofKeys / (double)nofSlots;[m + [m +[31m- for (entryIndex = 0; entryIndex < it->size; entryIndex++)[m +[32m+[m[32m for (entryIndex = 0; entryIndex < it->entriesSize; entryIndex++)[m + {[m + ItableEntry *entry = &(it->entries[entryIndex]);[m + [m +[1mdiff --git a/iup/src/iup_table.h b/iup/src/iup_table.h[m +[1mindex 5222160..f2ff2c7 100755[m +[1m--- a/iup/src/iup_table.h[m +[1m+++ b/iup/src/iup_table.h[m +[36m@@ -42,8 +42,8 @@[m [mtypedef enum _Itable_Types[m + [m + typedef void (*Ifunc)(void);[m + [m +[31m-struct Itable;[m +[31m-typedef struct Itable Itable;[m +[32m+[m[32mstruct _Itable;[m +[32m+[m[32mtypedef struct _Itable Itable;[m + [m + [m + /** Creates a hash table with an initial default size.[m +[36m@@ -63,7 +63,7 @@[m [mItable *iupTableCreateSized(Itable_IndexTypes indexType, unsigned int initialSiz[m + /** Destroys the Itable.[m + * Calls \ref iupTableClear.[m + * \ingroup table */[m +[31m-void iupTableDestroy(Itable *n);[m +[32m+[m[32mvoid iupTableDestroy(Itable *it);[m + [m + /** Removes all items in the table.[m + * This function does also free the memory of strings contained in the table!!!![m +[36m@@ -76,33 +76,33 @@[m [mint iupTableCount(Itable *it);[m + [m + /** Store an element in the table.[m + * \ingroup table */[m +[31m-void iupTableSet(Itable *n, const char *key, void *value, Itable_Types itemType);[m +[32m+[m[32mvoid iupTableSet(Itable *it, const char *key, void *value, Itable_Types itemType);[m + [m + /** Store a function pointer in the table.[m + * Type is set to IUPTABLE_FUNCPOINTER.[m + * \ingroup table */[m +[31m-void iupTableSetFunc(Itable *n, const char *key, Ifunc func);[m +[32m+[m[32mvoid iupTableSetFunc(Itable *it, const char *key, Ifunc func);[m + [m + /** Retrieves an element from the table.[m + * Returns NULL if not found.[m + * \ingroup table */[m +[31m-void *iupTableGet(Itable *n, const char *key);[m +[32m+[m[32mvoid *iupTableGet(Itable *it, const char *key);[m + [m + /** Retrieves a function pointer from the table. [m + * If not a function or not found returns NULL.[m + * value always contains the element pointer.[m + * \ingroup table */[m +[31m-Ifunc iupTableGetFunc(Itable *n, const char *key, void **value);[m +[32m+[m[32mIfunc iupTableGetFunc(Itable *it, const char *key, void **value);[m + [m + /** Retrieves an element from the table and its type.[m + * \ingroup table */[m +[31m-void *iupTableGetTyped(Itable *n, const char *key, Itable_Types *itemType);[m +[32m+[m[32mvoid *iupTableGetTyped(Itable *it, const char *key, Itable_Types *itemType);[m + [m + /** Removes the entry at the specified key from the[m + * hash table and frees the memory used by it if[m + * it is a string...[m + * \ingroup table */[m +[31m-void iupTableRemove(Itable *n, const char *key);[m +[32m+[m[32mvoid iupTableRemove(Itable *it, const char *key);[m + [m + /** Key iteration function. Returns a key.[m + * To iterate over all keys call iupTableFirst at the first[m +[1mdiff --git a/iup/src/iup_tabs.c b/iup/src/iup_tabs.c[m +[1mindex 77b2cf5..2907371 100755[m +[1m--- a/iup/src/iup_tabs.c[m +[1m+++ b/iup/src/iup_tabs.c[m +[36m@@ -307,6 +307,25 @@[m [mstatic char* iTabsGetClientSizeAttrib(Ihandle* ih)[m + return str;[m + }[m + [m +[32m+[m[32mvoid iupTabsTestRemoveTab(Ihandle* ih, int pos)[m +[32m+[m[32m{[m +[32m+[m[32m int cur_pos = iupdrvTabsGetCurrentTab(ih);[m +[32m+[m[32m if (cur_pos == pos)[m +[32m+[m[32m {[m +[32m+[m[32m if (cur_pos == 0)[m +[32m+[m[32m {[m +[32m+[m[32m Ihandle* child = IupGetChild(ih, 1);[m +[32m+[m[32m if (!child) /* not found child, means only one child, do nothing */[m +[32m+[m[32m return;[m +[32m+[m +[32m+[m[32m cur_pos = 1;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m cur_pos--;[m +[32m+[m +[32m+[m[32m iupdrvTabsSetCurrentTab(ih, cur_pos);[m +[32m+[m[32m }[m +[32m+[m[32m}[m + [m + /* ------------------------------------------------------------------------- */[m + /* TABS - Methods */[m +[1mdiff --git a/iup/src/iup_tabs.h b/iup/src/iup_tabs.h[m +[1mindex 7f5df2e..fd0edf4 100755[m +[1m--- a/iup/src/iup_tabs.h[m +[1m+++ b/iup/src/iup_tabs.h[m +[36m@@ -16,6 +16,7 @@[m [mchar* iupTabsGetTabOrientationAttrib(Ihandle* ih);[m + char* iupTabsGetTabTypeAttrib(Ihandle* ih);[m + char* iupTabsAttribGetStrId(Ihandle* ih, const char* name, int pos);[m + char* iupTabsGetPaddingAttrib(Ihandle* ih);[m +[32m+[m[32mvoid iupTabsTestRemoveTab(Ihandle* ih, int pos);[m + [m + int iupdrvTabsExtraDecor(Ihandle* ih);[m + int iupdrvTabsGetLineCountAttrib(Ihandle* ih);[m +[1mdiff --git a/iup/src/iup_tree.c b/iup/src/iup_tree.c[m +[1mindex c06e573..b5344f5 100755[m +[1m--- a/iup/src/iup_tree.c[m +[1m+++ b/iup/src/iup_tree.c[m +[36m@@ -200,6 +200,240 @@[m [mvoid iupTreeUpdateImages(Ihandle *ih)[m + iupClassObjectSetAttribute(ih, "IMAGEBRANCHEXPANDED", value, &inherit);[m + }[m + [m +[32m+[m[32mvoid iupTreeSelectLastCollapsedBranch(Ihandle* ih, int *last_id)[m +[32m+[m[32m{[m +[32m+[m[32m /* if last selected item is a branch, then select its children */[m +[32m+[m[32m if (iupStrEqual(IupTreeGetAttribute(ih, "KIND", *last_id), "BRANCH") &&[m[41m [m +[32m+[m[32m iupStrEqual(IupTreeGetAttribute(ih, "STATE", *last_id), "COLLAPSED"))[m +[32m+[m[32m {[m +[32m+[m[32m int childcount = IupTreeGetInt(ih, "CHILDCOUNT", *last_id);[m +[32m+[m[32m if (childcount > 0)[m +[32m+[m[32m {[m +[32m+[m[32m int start = *last_id + 1;[m +[32m+[m[32m int end = *last_id + childcount;[m +[32m+[m[32m IupSetfAttribute(ih, "MARK", "%d-%d", start, end);[m +[32m+[m[32m *last_id = *last_id + childcount;[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mint iupTreeForEach(Ihandle* ih, iupTreeNodeFunc func, void* userdata)[m +[32m+[m[32m{[m +[32m+[m[32m int i;[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (!func(ih, ih->data->node_cache[i].node_handle, i, userdata))[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m return 1;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mint iupTreeFindNodeId(Ihandle* ih, InodeHandle* node_handle)[m +[32m+[m[32m{[m +[32m+[m[32m /* Unoptimized version:[m +[32m+[m[32m int i;[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (ih->data->node_cache[i].node_handle == node_handle)[m +[32m+[m[32m return i;[m +[32m+[m[32m }[m +[32m+[m[32m */[m +[32m+[m[32m InodeData *node_cache = ih->data->node_cache;[m +[32m+[m[32m while(node_cache->node_handle != node_handle &&[m[41m [m +[32m+[m[32m node_cache->node_handle != NULL) /* the cache always have zeros at the end */[m +[32m+[m[32m node_cache++;[m +[32m+[m +[32m+[m[32m if (node_cache->node_handle != NULL)[m +[32m+[m[32m return node_cache - ih->data->node_cache;[m +[32m+[m[32m else[m +[32m+[m[32m return -1;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic int iTreeFindUserDataId(Ihandle* ih, void* userdata)[m +[32m+[m[32m{[m +[32m+[m[32m /* Unoptimized version:[m +[32m+[m[32m int i;[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (ih->data->node_cache[i].node_handle == node_handle)[m +[32m+[m[32m return i;[m +[32m+[m[32m }[m +[32m+[m[32m */[m +[32m+[m[32m InodeData *node_cache = ih->data->node_cache;[m +[32m+[m[32m while(node_cache->userdata != userdata &&[m[41m [m +[32m+[m[32m node_cache->node_handle != NULL) /* the cache always have zeros at the end */[m +[32m+[m[32m node_cache++;[m +[32m+[m +[32m+[m[32m if (node_cache->node_handle != NULL)[m +[32m+[m[32m return node_cache - ih->data->node_cache;[m +[32m+[m[32m else[m +[32m+[m[32m return -1;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic int iTreeGetIdFromString(const char* name_id)[m +[32m+[m[32m{[m +[32m+[m[32m if (name_id && name_id[0])[m +[32m+[m[32m {[m +[32m+[m[32m int id = -1;[m +[32m+[m[32m iupStrToInt(name_id, &id);[m +[32m+[m[32m return id;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m return -2;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mInodeHandle* iupTreeGetNode(Ihandle* ih, int id)[m +[32m+[m[32m{[m +[32m+[m[32m if (id >= 0 && id < ih->data->node_count)[m +[32m+[m[32m return ih->data->node_cache[id].node_handle;[m +[32m+[m[32m else if (id == -2)[m +[32m+[m[32m return iupdrvTreeGetFocusNode(ih);[m +[32m+[m[32m else[m +[32m+[m[32m return NULL;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mInodeHandle* iupTreeGetNodeFromString(Ihandle* ih, const char* name_id)[m +[32m+[m[32m{[m +[32m+[m[32m return iupTreeGetNode(ih, iTreeGetIdFromString(name_id));[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void iTreeAddToCache(Ihandle* ih, int id, InodeHandle* node_handle)[m +[32m+[m[32m{[m +[32m+[m[32m iupASSERT(id >= 0 && id < ih->data->node_count);[m +[32m+[m[32m if (id < 0 || id >= ih->data->node_count)[m +[32m+[m[32m return;[m +[32m+[m +[32m+[m[32m /* node_count here already contains the final count */[m +[32m+[m +[32m+[m[32m if (id == ih->data->node_count-1)[m +[32m+[m[32m ih->data->node_cache[id].node_handle = node_handle;[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m /* open space for the new id */[m +[32m+[m[32m int remain_count = ih->data->node_count-id;[m +[32m+[m[32m memmove(ih->data->node_cache+id+1, ih->data->node_cache+id, remain_count*sizeof(InodeData));[m +[32m+[m[32m ih->data->node_cache[id].node_handle = node_handle;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m ih->data->node_cache[id].userdata = NULL;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void iTreeIncCacheMem(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m /* node_count here already contains the final count */[m +[32m+[m +[32m+[m[32m if (ih->data->node_count+10 > ih->data->node_cache_max)[m +[32m+[m[32m {[m +[32m+[m[32m int old_node_cache_max = ih->data->node_cache_max;[m +[32m+[m[32m ih->data->node_cache_max += 20;[m +[32m+[m[32m ih->data->node_cache = realloc(ih->data->node_cache, ih->data->node_cache_max*sizeof(InodeData));[m +[32m+[m[32m memset(ih->data->node_cache+old_node_cache_max, 0, 20*sizeof(InodeData));[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupTreeAddToCache(Ihandle* ih, int add, int kindPrev, InodeHandle* prevNode, InodeHandle* node_handle)[m +[32m+[m[32m{[m +[32m+[m[32m int new_id = 0;[m +[32m+[m +[32m+[m[32m ih->data->node_count++;[m +[32m+[m +[32m+[m[32m /* node_count here already contains the final count */[m +[32m+[m[32m iTreeIncCacheMem(ih);[m +[32m+[m +[32m+[m[32m if (prevNode)[m +[32m+[m[32m {[m +[32m+[m[32m if (add || kindPrev == ITREE_LEAF)[m +[32m+[m[32m {[m +[32m+[m[32m /* ADD implies always that id=prev_id+1 */[m +[32m+[m[32m /* INSERT after a leaf implies always that new_id=prev_id+1 */[m +[32m+[m[32m int prev_id = iupTreeFindNodeId(ih, prevNode);[m +[32m+[m[32m new_id = prev_id+1;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m /* INSERT after a branch implies always that new_id=prev_id+1+child_count */[m +[32m+[m[32m int prev_id = iupTreeFindNodeId(ih, prevNode);[m +[32m+[m[32m int child_count = iupdrvTreeTotalChildCount(ih, prevNode);[m +[32m+[m[32m new_id = prev_id+1+child_count;[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m iTreeAddToCache(ih, new_id, node_handle);[m +[32m+[m[32m iupAttribSetInt(ih, "LASTADDNODE", new_id);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupTreeDelFromCache(Ihandle* ih, int id, int count)[m +[32m+[m[32m{[m +[32m+[m[32m int remain_count;[m +[32m+[m +[32m+[m[32m /* id can be the last node, actually==node_count becase node_count is already updated */[m +[32m+[m[32m iupASSERT(id >= 0 && id <= ih->data->node_count);[m[41m [m +[32m+[m[32m if (id < 0 || id > ih->data->node_count)[m +[32m+[m[32m return;[m +[32m+[m +[32m+[m[32m /* node_count here already contains the final count */[m +[32m+[m +[32m+[m[32m /* remove id+count */[m +[32m+[m[32m remain_count = ih->data->node_count-id;[m +[32m+[m[32m memmove(ih->data->node_cache+id, ih->data->node_cache+id+count, remain_count*sizeof(InodeData));[m +[32m+[m +[32m+[m[32m /* clear the remaining space */[m +[32m+[m[32m memset(ih->data->node_cache+ih->data->node_count, 0, count*sizeof(InodeData));[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupTreeCopyMoveCache(Ihandle* ih, int id_src, int id_dst, int count, int is_copy)[m +[32m+[m[32m{[m +[32m+[m[32m int remain_count;[m +[32m+[m +[32m+[m[32m iupASSERT(id_src >= 0 && id_src < ih->data->node_count);[m +[32m+[m[32m if (id_src < 0 || id_src >= ih->data->node_count)[m +[32m+[m[32m return;[m +[32m+[m +[32m+[m[32m iupASSERT(id_dst >= 0 && id_dst < ih->data->node_count);[m +[32m+[m[32m if (id_dst < 0 || id_dst >= ih->data->node_count)[m +[32m+[m[32m return;[m +[32m+[m +[32m+[m[32m iupASSERT(id_dst < id_src || id_dst > id_src+count);[m +[32m+[m[32m if (id_dst >= id_src && id_dst <= id_src+count)[m +[32m+[m[32m return;[m +[32m+[m +[32m+[m[32m /* id_dst here points to the final position for a copy operation */[m +[32m+[m +[32m+[m[32m /* node_count here contains the final count for a copy operation */[m +[32m+[m[32m iTreeIncCacheMem(ih);[m +[32m+[m +[32m+[m[32m /* add space for new nodes */[m +[32m+[m[32m remain_count = ih->data->node_count - (id_dst + count);[m +[32m+[m[32m memmove(ih->data->node_cache+id_dst+count, ih->data->node_cache+id_dst, remain_count*sizeof(InodeData));[m +[32m+[m +[32m+[m[32m /* compensate because we add space for new nodes */[m +[32m+[m[32m if (id_src > id_dst)[m +[32m+[m[32m id_src += count;[m +[32m+[m +[32m+[m[32m if (is_copy)[m[41m [m +[32m+[m[32m {[m +[32m+[m[32m /* during a copy, the userdata is not reused, so clear it */[m +[32m+[m[32m memset(ih->data->node_cache+id_dst, 0, count*sizeof(InodeData));[m +[32m+[m[32m }[m +[32m+[m[32m else /* move = copy + delete */[m +[32m+[m[32m {[m +[32m+[m[32m /* copy userdata from src to dst */[m +[32m+[m[32m memcpy(ih->data->node_cache+id_dst, ih->data->node_cache+id_src, count*sizeof(InodeData));[m +[32m+[m +[32m+[m[32m /* remove the src */[m +[32m+[m[32m remain_count = ih->data->node_count - (id_src + count);[m +[32m+[m[32m memmove(ih->data->node_cache+id_src, ih->data->node_cache+id_src+count, remain_count*sizeof(InodeData));[m +[32m+[m +[32m+[m[32m /* clear the remaining space */[m +[32m+[m[32m memset(ih->data->node_cache+ih->data->node_count-count, 0, count*sizeof(InodeData));[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m +[32m+[m[32m/*************************************************************************/[m +[32m+[m +[32m+[m + char* iupTreeGetSpacingAttrib(Ihandle* ih)[m + {[m + char *str = iupStrGetMemory(50);[m +[36m@@ -221,8 +455,10 @@[m [mstatic int iTreeSetMarkModeAttrib(Ihandle* ih, const char* value)[m + ih->data->mark_mode = ITREE_MARK_MULTIPLE; [m + else [m + ih->data->mark_mode = ITREE_MARK_SINGLE;[m +[32m+[m + if (ih->handle)[m +[31m- iupdrvTreeUpdateMarkMode(ih);[m +[32m+[m[32m iupdrvTreeUpdateMarkMode(ih); /* for this to work, must update during map */[m +[32m+[m + return 0;[m + }[m + [m +[36m@@ -290,7 +526,7 @@[m [mstatic int iTreeSetShowDragDropAttrib(Ihandle* ih, const char* value)[m + [m + static int iTreeSetAddLeafAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + iupdrvTreeAddNode(ih, name_id, ITREE_LEAF, value, 1);[m + return 0;[m +[36m@@ -298,7 +534,7 @@[m [mstatic int iTreeSetAddLeafAttrib(Ihandle* ih, const char* name_id, const char* v[m + [m + static int iTreeSetAddBranchAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + iupdrvTreeAddNode(ih, name_id, ITREE_BRANCH, value, 1);[m + return 0;[m +[36m@@ -306,7 +542,7 @@[m [mstatic int iTreeSetAddBranchAttrib(Ihandle* ih, const char* name_id, const char*[m + [m + static int iTreeSetInsertLeafAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + iupdrvTreeAddNode(ih, name_id, ITREE_LEAF, value, 0);[m + return 0;[m +[36m@@ -314,7 +550,7 @@[m [mstatic int iTreeSetInsertLeafAttrib(Ihandle* ih, const char* name_id, const char[m + [m + static int iTreeSetInsertBranchAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + iupdrvTreeAddNode(ih, name_id, ITREE_BRANCH, value, 0);[m + return 0;[m +[36m@@ -338,6 +574,74 @@[m [mstatic int iTreeSetAddExpandedAttrib(Ihandle* ih, const char* value)[m + return 0;[m + }[m + [m +[32m+[m[32mstatic char* iTreeGetCountAttrib(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m char* str = iupStrGetMemory(10);[m +[32m+[m[32m sprintf(str, "%d", ih->data->node_count);[m +[32m+[m[32m return str;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic char* iTreeGetTotalChildCountAttrib(Ihandle* ih, const char* name_id)[m +[32m+[m[32m{[m +[32m+[m[32m char* str;[m +[32m+[m[32m InodeHandle* node_handle = iupTreeGetNodeFromString(ih, name_id);[m +[32m+[m[32m if (!node_handle)[m +[32m+[m[32m return NULL;[m +[32m+[m +[32m+[m[32m str = iupStrGetMemory(10);[m +[32m+[m[32m sprintf(str, "%d", iupdrvTreeTotalChildCount(ih, node_handle));[m +[32m+[m[32m return str;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m +[32m+[m[32mstatic char* iTreeGetFindUserDataAttrib(Ihandle* ih, const char* name_id)[m +[32m+[m[32m{[m +[32m+[m[32m int id;[m +[32m+[m[32m char* str = (char*)(name_id+1); /* skip ':' */[m +[32m+[m[32m void* userdata = NULL;[m +[32m+[m[32m if (sscanf(str, "%p", &userdata)!=1)[m +[32m+[m[32m return NULL;[m +[32m+[m[32m id = iTreeFindUserDataId(ih, userdata);[m +[32m+[m[32m if (id == -1)[m +[32m+[m[32m return NULL;[m +[32m+[m[32m str = iupStrGetMemory(16);[m +[32m+[m[32m sprintf(str, "%d", id);[m +[32m+[m[32m return str;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic char* iTreeGetUserDataAttrib(Ihandle* ih, const char* name_id)[m +[32m+[m[32m{[m +[32m+[m[32m int id = iTreeGetIdFromString(name_id);[m +[32m+[m[32m if (id >= 0 && id < ih->data->node_count)[m +[32m+[m[32m return ih->data->node_cache[id].userdata;[m +[32m+[m[32m else if (id == -2)[m +[32m+[m[32m {[m +[32m+[m[32m InodeHandle* node_handle = iupdrvTreeGetFocusNode(ih);[m +[32m+[m[32m id = iupTreeFindNodeId(ih, node_handle);[m +[32m+[m[32m if (id >= 0 && id < ih->data->node_count)[m +[32m+[m[32m return ih->data->node_cache[id].userdata;[m +[32m+[m[32m }[m +[32m+[m[32m return NULL;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic int iTreeSetUserDataAttrib(Ihandle* ih, const char* name_id, const char* value)[m +[32m+[m[32m{[m +[32m+[m[32m int id = iTreeGetIdFromString(name_id);[m +[32m+[m[32m if (id >= 0 && id < ih->data->node_count)[m +[32m+[m[32m ih->data->node_cache[id].userdata = (void*)value;[m +[32m+[m[32m else if (id == -2)[m +[32m+[m[32m {[m +[32m+[m[32m InodeHandle* node_handle = iupdrvTreeGetFocusNode(ih);[m +[32m+[m[32m id = iupTreeFindNodeId(ih, node_handle);[m +[32m+[m[32m if (id >= 0 && id < ih->data->node_count)[m +[32m+[m[32m ih->data->node_cache[id].userdata = (void*)value;[m +[32m+[m[32m }[m +[32m+[m[32m return 0;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m +[32m+[m[32m/*************************************************************************/[m +[32m+[m + static int iTreeCreateMethod(Ihandle* ih, void **params)[m + {[m + (void)params;[m +[36m@@ -348,10 +652,20 @@[m [mstatic int iTreeCreateMethod(Ihandle* ih, void **params)[m + IupSetAttribute(ih, "EXPAND", "YES");[m + [m + ih->data->add_expanded = 1;[m +[32m+[m[32m ih->data->node_cache_max = 20;[m +[32m+[m[32m ih->data->node_cache = calloc(ih->data->node_cache_max, sizeof(InodeData));[m + [m + return IUP_NOERROR;[m + }[m + [m +[32m+[m[32mstatic void iTreeDestroyMethod(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m if (ih->data->node_cache)[m +[32m+[m[32m free(ih->data->node_cache);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32m/*************************************************************************/[m +[32m+[m + Ihandle* IupTree(void)[m + {[m + return IupCreate("tree");[m +[36m@@ -371,15 +685,15 @@[m [mIclass* iupTreeGetClass(void)[m + /* Class functions */[m + ic->Create = iTreeCreateMethod;[m + ic->LayoutUpdate = iupdrvBaseLayoutUpdateMethod;[m +[31m- ic->UnMap = iupdrvBaseUnMapMethod;[m +[32m+[m[32m ic->Destroy = iTreeDestroyMethod;[m + [m + /* Callbacks */[m + iupClassRegisterCallback(ic, "SELECTION_CB", "ii");[m + iupClassRegisterCallback(ic, "MULTISELECTION_CB", "Ii");[m +[32m+[m[32m iupClassRegisterCallback(ic, "MULTIUNSELECTION_CB", "Ii");[m + iupClassRegisterCallback(ic, "BRANCHOPEN_CB", "i");[m + iupClassRegisterCallback(ic, "BRANCHCLOSE_CB", "i");[m + iupClassRegisterCallback(ic, "EXECUTELEAF_CB", "i");[m +[31m- iupClassRegisterCallback(ic, "RENAMENODE_CB", "is");[m + iupClassRegisterCallback(ic, "SHOWRENAME_CB", "i");[m + iupClassRegisterCallback(ic, "RENAME_CB", "is");[m + iupClassRegisterCallback(ic, "DRAGDROP_CB", "iiii");[m +[36m@@ -392,9 +706,12 @@[m [mIclass* iupTreeGetClass(void)[m + iupBaseRegisterVisualAttrib(ic);[m + [m + /* IupTree Attributes - GENERAL */[m +[31m- iupClassRegisterAttribute(ic, "SHOWDRAGDROP", iTreeGetShowDragDropAttrib, iTreeSetShowDragDropAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttribute(ic, "SHOWRENAME", iTreeGetShowRenameAttrib, iTreeSetShowRenameAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttribute(ic, "ADDEXPANDED", iTreeGetAddExpandedAttrib, iTreeSetAddExpandedAttrib, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "SHOWDRAGDROP", iTreeGetShowDragDropAttrib, iTreeSetShowDragDropAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "SHOWRENAME", iTreeGetShowRenameAttrib, iTreeSetShowRenameAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "ADDEXPANDED", iTreeGetAddExpandedAttrib, iTreeSetAddExpandedAttrib, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "COUNT", iTreeGetCountAttrib, NULL, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_READONLY|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "LASTADDNODE", NULL, NULL, IUPAF_SAMEASSYSTEM, NULL, IUPAF_READONLY|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "ADDROOT", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NO_INHERIT);[m + [m + /* IupTree Attributes - MARKS */[m + iupClassRegisterAttribute(ic, "CTRL", NULL, iTreeSetCtrlAttrib, NULL, NULL, IUPAF_NOT_MAPPED);[m +[36m@@ -406,6 +723,11 @@[m [mIclass* iupTreeGetClass(void)[m + iupClassRegisterAttributeId(ic, "ADDBRANCH", NULL, iTreeSetAddBranchAttrib, IUPAF_NOT_MAPPED|IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "INSERTLEAF", NULL, iTreeSetInsertLeafAttrib, IUPAF_NOT_MAPPED|IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "INSERTBRANCH", NULL, iTreeSetInsertBranchAttrib, IUPAF_NOT_MAPPED|IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m +[32m+[m +[32m+[m[32m /* IupTree Attributes - NODES */[m +[32m+[m[32m iupClassRegisterAttributeId(ic, "TOTALCHILDCOUNT", iTreeGetTotalChildCountAttrib, NULL, IUPAF_READONLY|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttributeId(ic, "FINDUSERDATA", iTreeGetFindUserDataAttrib, NULL, IUPAF_READONLY|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttributeId(ic, "USERDATA", iTreeGetUserDataAttrib, iTreeSetUserDataAttrib, IUPAF_NO_STRING|IUPAF_NO_INHERIT);[m + [m + /* Default node images */[m + iTreeInitializeImages();[m +[36m@@ -415,18 +737,23 @@[m [mIclass* iupTreeGetClass(void)[m + return ic;[m + }[m + [m +[31m-[m + /********************************************************************************************/[m + [m +[31m-[m +[31m-void IupTreeSetAttribute(Ihandle* ih, const char* a, int id, char* v)[m +[32m+[m[32mvoid IupTreeSetAttribute(Ihandle* ih, const char* a, int id, const char* v)[m + {[m + char* attr = iupStrGetMemory(50);[m + sprintf(attr, "%s%d", a, id);[m + IupSetAttribute(ih, attr, v);[m + }[m + [m +[31m-void IupTreeStoreAttribute(Ihandle* ih, const char* a, int id, char* v)[m +[32m+[m[32mvoid IupTreeSetAttributeHandle(Ihandle* ih, const char* a, int id, Ihandle* ih_named)[m +[32m+[m[32m{[m +[32m+[m[32m char* attr = iupStrGetMemory(50);[m +[32m+[m[32m sprintf(attr, "%s%d", a, id);[m +[32m+[m[32m IupSetAttributeHandle(ih, attr, ih_named);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid IupTreeStoreAttribute(Ihandle* ih, const char* a, int id, const char* v)[m + {[m + char* attr = iupStrGetMemory(50);[m + sprintf(attr, "%s%d", a, id);[m +[36m@@ -454,7 +781,7 @@[m [mfloat IupTreeGetFloat(Ihandle* ih, const char* a, int id)[m + return IupGetFloat(ih, attr);[m + }[m + [m +[31m-void IupTreeSetfAttribute(Ihandle* ih, const char* a, int id, char* f, ...)[m +[32m+[m[32mvoid IupTreeSetfAttribute(Ihandle* ih, const char* a, int id, const char* f, ...)[m + {[m + static char v[SHRT_MAX];[m + char* attr = iupStrGetMemory(50);[m +[36m@@ -466,34 +793,40 @@[m [mvoid IupTreeSetfAttribute(Ihandle* ih, const char* a, int id, char* f, ...)[m + IupStoreAttribute(ih, attr, v);[m + }[m + [m +[31m-[m + /************************************************************************************/[m + [m +[31m-[m + int IupTreeSetUserId(Ihandle* ih, int id, void* userdata)[m + {[m +[31m- char attr[30];[m +[31m- sprintf(attr,"USERDATA%d",id);[m +[31m- IupSetAttribute(ih, attr, userdata);[m +[31m- return IupGetAttribute(ih, attr)? 1: 0;[m +[32m+[m[32m iupASSERT(iupObjectCheck(ih));[m +[32m+[m[32m if (!iupObjectCheck(ih))[m +[32m+[m[32m return 0;[m +[32m+[m +[32m+[m[32m if (id >= 0 && id < ih->data->node_count)[m +[32m+[m[32m {[m +[32m+[m[32m ih->data->node_cache[id].userdata = userdata;[m +[32m+[m[32m return 1;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m return 0;[m + }[m + [m + int IupTreeGetId(Ihandle* ih, void *userdata)[m + {[m +[31m- int id = -1;[m +[31m- char* value;[m +[31m- char attr[30];[m +[31m- sprintf(attr,"FINDUSERDATA:%p",userdata);[m +[31m- value = IupGetAttribute(ih, attr);[m +[31m- if (!value) return -1;[m +[32m+[m[32m iupASSERT(iupObjectCheck(ih));[m +[32m+[m[32m if (!iupObjectCheck(ih))[m +[32m+[m[32m return -1;[m + [m +[31m- iupStrToInt(value, &id);[m +[31m- return id;[m +[32m+[m[32m return iTreeFindUserDataId(ih, userdata);[m + }[m + [m + void* IupTreeGetUserId(Ihandle* ih, int id)[m + {[m +[31m- char attr[30];[m +[31m- sprintf(attr,"USERDATA%d",id);[m +[31m- return IupGetAttribute(ih, attr);[m +[32m+[m[32m iupASSERT(iupObjectCheck(ih));[m +[32m+[m[32m if (!iupObjectCheck(ih))[m +[32m+[m[32m return NULL;[m +[32m+[m +[32m+[m[32m if (id >= 0 && id < ih->data->node_count)[m +[32m+[m[32m return ih->data->node_cache[id].userdata;[m +[32m+[m +[32m+[m[32m return NULL;[m + }[m +[1mdiff --git a/iup/src/iup_tree.h b/iup/src/iup_tree.h[m +[1mindex f96a698..44acc83 100755[m +[1m--- a/iup/src/iup_tree.h[m +[1m+++ b/iup/src/iup_tree.h[m +[36m@@ -29,6 +29,36 @@[m [mvoid iupdrvTreeUpdateMarkMode(Ihandle *ih);[m + [m + char* iupTreeGetSpacingAttrib(Ihandle* ih);[m + [m +[32m+[m[32m#if defined(GTK_MAJOR_VERSION)[m +[32m+[m[32mtypedef void InodeHandle;[m +[32m+[m[32m#elif defined(XmVERSION)[m +[32m+[m[32mtypedef struct _WidgetRec InodeHandle;[m +[32m+[m[32m#elif defined(WINVER)[m +[32m+[m[32mtypedef struct _TREEITEM InodeHandle;[m +[32m+[m[32m#else[m +[32m+[m[32mtypedef struct _InodeData InodeHandle;[m +[32m+[m[32m#endif[m +[32m+[m +[32m+[m[32mtypedef struct _InodeData[m +[32m+[m[32m{[m +[32m+[m[32m InodeHandle* node_handle;[m +[32m+[m[32m void* userdata;[m +[32m+[m[32m} InodeData;[m +[32m+[m +[32m+[m[32mtypedef int (*iupTreeNodeFunc)(Ihandle* ih, InodeHandle* node_handle, int id, void* userdata);[m +[32m+[m[32mint iupTreeForEach(Ihandle* ih, iupTreeNodeFunc func, void* userdata);[m +[32m+[m[32mInodeHandle* iupTreeGetNode(Ihandle* ih, int id);[m +[32m+[m[32mInodeHandle* iupTreeGetNodeFromString(Ihandle* ih, const char* name_id);[m +[32m+[m[32mint iupTreeFindNodeId(Ihandle* ih, InodeHandle* node_handle);[m +[32m+[m +[32m+[m[32mInodeHandle* iupdrvTreeGetFocusNode(Ihandle* ih);[m +[32m+[m[32mint iupdrvTreeTotalChildCount(Ihandle* ih, InodeHandle* node_handle);[m +[32m+[m[32mvoid iupTreeSelectLastCollapsedBranch(Ihandle* ih, int *last_id);[m +[32m+[m +[32m+[m[32mvoid iupTreeDelFromCache(Ihandle* ih, int id, int count);[m +[32m+[m[32mvoid iupTreeAddToCache(Ihandle* ih, int add, int kindPrev, InodeHandle* prevNode, InodeHandle* node_handle);[m +[32m+[m[32mvoid iupTreeCopyMoveCache(Ihandle* ih, int id_src, int id_dst, int count, int is_copy);[m +[32m+[m + /* Structure of the tree */[m + struct _IcontrolData[m + {[m +[36m@@ -36,6 +66,7 @@[m [mstruct _IcontrolData[m + add_expanded,[m + show_dragdrop,[m + show_rename,[m +[32m+[m[32m stamp, /* GTK only */[m + spacing;[m + [m + void* def_image_leaf; /* Default image leaf */[m +[36m@@ -44,9 +75,10 @@[m [mstruct _IcontrolData[m + [m + void* def_image_leaf_mask; /* Motif Only */[m + void* def_image_collapsed_mask; [m +[31m- void* def_image_expanded_mask; [m +[32m+[m[32m void* def_image_expanded_mask;[m[41m [m + [m +[31m- int id_control; /* auxiliary variable for computing or finding the id of a node */[m +[32m+[m[32m InodeData *node_cache;[m +[32m+[m[32m int node_cache_max, node_count;[m + };[m + [m + [m +[1mdiff --git a/iup/src/iup_vbox.c b/iup/src/iup_vbox.c[m +[1mindex f71aa51..23e8e3a 100755[m +[1m--- a/iup/src/iup_vbox.c[m +[1m+++ b/iup/src/iup_vbox.c[m +[36m@@ -215,6 +215,13 @@[m [mstatic void iVboxSetChildrenCurrentSizeMethod(Ihandle* ih, int shrink)[m + else[m + {[m + int empty = (child->expand & IUP_EXPAND_H1)? empty_h1: ((child->expand & IUP_EXPAND_H0)? empty_h0: 0);[m +[32m+[m[32m char* weigth_str = iupAttribGet(child, "EXPANDWEIGTH");[m +[32m+[m[32m if (weigth_str)[m +[32m+[m[32m {[m +[32m+[m[32m float weigth;[m[41m [m +[32m+[m[32m if (iupStrToFloat(weigth_str, &weigth))[m +[32m+[m[32m empty = iupROUND(empty * weigth);[m +[32m+[m[32m }[m + iupBaseSetCurrentSize(child, client_width, child->naturalheight+empty, shrink);[m + }[m + [m +[1mdiff --git a/iup/src/iup_zbox.c b/iup/src/iup_zbox.c[m +[1mindex 3f79892..dd4a0e4 100755[m +[1m--- a/iup/src/iup_zbox.c[m +[1m+++ b/iup/src/iup_zbox.c[m +[36m@@ -210,7 +210,7 @@[m [mstatic int iZboxSetVisibleAttrib(Ihandle* ih, const char* value)[m + {[m + if (iupObjectCheck(ih->data->value_handle))[m + IupSetAttribute(ih->data->value_handle, "VISIBLE", (char*)value);[m +[31m- return 0;[m +[32m+[m[32m return 1; /* must be 1 to mark when set at the element */[m + }[m + [m + static void iZboxComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)[m +[36m@@ -368,8 +368,8 @@[m [mIclass* iupZboxGetClass(void)[m + iupClassRegisterAttribute(ic, "VALUEPOS", iZboxGetValuePosAttrib, iZboxSetValuePosAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "VALUE_HANDLE", NULL, iZboxSetValueHandleAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT|IUPAF_NO_STRING);[m + [m +[31m- /* Intercept VISIBLE since ZBOX works showing and hidding its children */[m +[31m- iupClassRegisterAttribute(ic, "VISIBLE", NULL, iZboxSetVisibleAttrib, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[32m /* Intercept VISIBLE since ZBOX works by showing and hidding its children */[m +[32m+[m[32m iupClassRegisterAttribute(ic, "VISIBLE", NULL, iZboxSetVisibleAttrib, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NOT_MAPPED);[m + [m + return ic;[m + }[m +[1mdiff --git a/iup/src/make_uname b/iup/src/make_uname[m +[1mindex 7fec9f8..6542234 100755[m +[1m--- a/iup/src/make_uname[m +[1m+++ b/iup/src/make_uname[m +[36m@@ -1,4 +1,4 @@[m + #This builds all the libraries of the folder for 1 uname[m + [m +[31m-tecmake $1 $2 $3 $4 $5 $6 $7[m +[32m+[m[32mtecmake USE_MOTIF=Yes $1 $2 $3 $4 $5 $6 $7[m + tecmake USE_GTK=Yes $1 $2 $3 $4 $5 $6 $7[m +[1mdiff --git a/iup/src/mot/iupmot_button.c b/iup/src/mot/iupmot_button.c[m +[1mindex 2d93588..f6e383f 100755[m +[1m--- a/iup/src/mot/iupmot_button.c[m +[1m+++ b/iup/src/mot/iupmot_button.c[m +[36m@@ -112,8 +112,10 @@[m [mstatic int motButtonSetPaddingAttrib(Ihandle* ih, const char* value)[m + {[m + XtVaSetValues(ih->handle, XmNmarginHeight, ih->data->vert_padding,[m + XmNmarginWidth, ih->data->horiz_padding, NULL);[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int motButtonSetBgColorAttrib(Ihandle* ih, const char* value)[m +[36m@@ -189,43 +191,43 @@[m [mstatic int motButtonMapMethod(Ihandle* ih)[m + if (value)[m + {[m + ih->data->type = IUP_BUTTON_IMAGE;[m +[31m- iupmotSetArg(args, num_args, XmNlabelType, XmPIXMAP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelType, XmPIXMAP);[m + }[m + else[m + {[m + ih->data->type = IUP_BUTTON_TEXT;[m +[31m- iupmotSetArg(args, num_args, XmNlabelType, XmSTRING);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelType, XmSTRING);[m + }[m + [m + /* Core */[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + /* Label */[m +[31m- iupmotSetArg(args, num_args, XmNrecomputeSize, False); /* no automatic resize from text */[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginTop, 0); /* no extra margins */[m +[31m- iupmotSetArg(args, num_args, XmNmarginLeft, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginBottom, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginRight, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNrecomputeSize, False); /* no automatic resize from text */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginTop, 0); /* no extra margins */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginLeft, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginBottom, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginRight, 0);[m + /* PushButton */[m +[31m- iupmotSetArg(args, num_args, XmNfillOnArm, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNfillOnArm, False);[m + [m + /* Primitive */[m + if (iupAttribGetBoolean(ih, "FOCUSONCLICK"))[m + {[m + if (iupAttribGetBoolean(ih, "CANFOCUS"))[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m + }[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 2);[m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP);[m + [m + ih->handle = XtCreateManagedWidget([m + iupDialogGetChildIdStr(ih), /* child identifier */[m +[1mdiff --git a/iup/src/mot/iupmot_canvas.c b/iup/src/mot/iupmot_canvas.c[m +[1mindex 7777cf3..299bbcd 100755[m +[1m--- a/iup/src/mot/iupmot_canvas.c[m +[1m+++ b/iup/src/mot/iupmot_canvas.c[m +[36m@@ -434,6 +434,10 @@[m [mstatic void motCanvasLayoutUpdateMethod(Ihandle *ih)[m + [m + XtVaGetValues(sb_win, XmNborderWidth, &border, NULL);[m + [m +[32m+[m[32m /* avoid abort in X */[m +[32m+[m[32m if (ih->currentwidth <= 2*border) ih->currentwidth = 2*border+1;[m +[32m+[m[32m if (ih->currentheight <= 2*border) ih->currentheight = 2*border+1;[m +[32m+[m + XtVaSetValues(sb_win,[m + XmNx, (XtArgVal)ih->x,[m + XmNy, (XtArgVal)ih->y,[m +[36m@@ -458,19 +462,19 @@[m [mstatic int motCanvasMapMethod(Ihandle* ih)[m + /* Create the scrolled window */[m + /******************************/[m + [m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNscrollingPolicy, XmAPPLICATION_DEFINED);[m +[31m- iupmotSetArg(args, num_args, XmNvisualPolicy, XmVARIABLE);[m +[31m- iupmotSetArg(args, num_args, XmNspacing, 0); /* no space between scrollbars and draw area */[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollingPolicy, XmAPPLICATION_DEFINED);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNvisualPolicy, XmVARIABLE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNspacing, 0); /* no space between scrollbars and draw area */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m + [m + if (iupAttribGetBoolean(ih, "BORDER"))[m + {[m +[31m- iupmotSetArg(args, num_args, XmNborderWidth, 1);[m +[31m- iupmotSetArg(args, num_args, XmNborderColor, iupmotColorGetPixelStr("0 0 0"));[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNborderWidth, 1);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNborderColor, iupmotColorGetPixelStr("0 0 0"));[m + }[m + else[m +[31m- iupmotSetArg(args, num_args, XmNborderWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNborderWidth, 0);[m + [m + sb_win = XtCreateManagedWidget([m + iupDialogGetChildIdStr(ih), /* child identifier */[m +[36m@@ -488,36 +492,36 @@[m [mstatic int motCanvasMapMethod(Ihandle* ih)[m + /****************************/[m + [m + num_args = 0;[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* no shadow margins */[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0); /* no shadow margins */[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[31m- iupmotSetArg(args, num_args, XmNresizePolicy, XmRESIZE_NONE); /* no automatic resize of children */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* no shadow margins */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0); /* no shadow margins */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNresizePolicy, XmRESIZE_NONE); /* no automatic resize of children */[m + if (ih->iclass->is_interactive)[m + {[m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP); /* include in navigation */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP); /* include in navigation */[m + [m + if (iupAttribGetBoolean(ih, "CANFOCUS"))[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m + }[m + else[m + {[m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmNONE);[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmNONE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m + }[m + [m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + [m + visual = IupGetAttribute(ih, "VISUAL"); /* defined by the OpenGL Canvas or NULL */[m + if (visual)[m + {[m + Colormap colormap = (Colormap)iupAttribGet(ih, "COLORMAP");[m + if (colormap)[m +[31m- iupmotSetArg(args, num_args, XmNcolormap,colormap);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNcolormap,colormap);[m + [m + iupmotDialogSetVisual(ih, visual);[m + }[m +[1mdiff --git a/iup/src/mot/iupmot_common.c b/iup/src/mot/iupmot_common.c[m +[1mindex 7b3f8b7..286e075 100755[m +[1m--- a/iup/src/mot/iupmot_common.c[m +[1m+++ b/iup/src/mot/iupmot_common.c[m +[36m@@ -167,6 +167,10 @@[m [mvoid iupdrvBaseLayoutUpdateMethod(Ihandle *ih)[m + Widget widget = (Widget)iupAttribGet(ih, "_IUP_EXTRAPARENT");[m + if (!widget) widget = ih->handle;[m + [m +[32m+[m[32m /* avoid abort in X */[m +[32m+[m[32m if (ih->currentwidth == 0) ih->currentwidth = 1;[m +[32m+[m[32m if (ih->currentheight == 0) ih->currentheight = 1;[m +[32m+[m + XtVaSetValues(widget,[m + XmNx, (XtArgVal)ih->x,[m + XmNy, (XtArgVal)ih->y,[m +[36m@@ -184,7 +188,7 @@[m [mvoid iupdrvBaseUnMapMethod(Ihandle* ih)[m + XtDestroyWidget(widget); /* To match the call to XtCreateManagedWidget */[m + }[m + [m +[31m-void iupdrvDisplayUpdate(Ihandle *ih)[m +[32m+[m[32mvoid iupdrvPostRedraw(Ihandle *ih)[m + {[m + XExposeEvent evt;[m + Dimension w, h;[m +[36m@@ -209,12 +213,12 @@[m [mvoid iupdrvDisplayUpdate(Ihandle *ih)[m + XSendEvent(iupmot_display, XtWindow(ih->handle), False, ExposureMask, (XEvent*)&evt);[m + }[m + [m +[31m-void iupdrvDisplayRedraw(Ihandle *ih)[m +[32m+[m[32mvoid iupdrvRedrawNow(Ihandle *ih)[m + {[m + Widget w;[m + [m + /* POST a Redraw */[m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + [m + /* if this element has an inner native parent (like IupTabs), [m + then redraw that native parent if different from the element. */[m +[36m@@ -223,7 +227,7 @@[m [mvoid iupdrvDisplayRedraw(Ihandle *ih)[m + {[m + Widget handle = ih->handle;[m + ih->handle = w;[m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + ih->handle = handle;[m + }[m + [m +[36m@@ -276,10 +280,11 @@[m [mint iupdrvBaseSetZorderAttrib(Ihandle* ih, const char* value)[m + {[m + if (iupdrvIsVisible(ih))[m + {[m +[32m+[m[32m Widget widget = (Widget)iupAttribGet(ih, "_IUP_EXTRAPARENT");[m + if (iupStrEqualNoCase(value, "TOP"))[m +[31m- XRaiseWindow(iupmot_display, XtWindow(ih->handle));[m +[32m+[m[32m XRaiseWindow(iupmot_display, XtWindow(widget));[m + else[m +[31m- XLowerWindow(iupmot_display, XtWindow(ih->handle));[m +[32m+[m[32m XLowerWindow(iupmot_display, XtWindow(widget));[m + }[m + [m + return 0;[m +[36m@@ -455,9 +460,11 @@[m [mstatic Cursor motGetCursor(Ihandle* ih, const char* name)[m + { "RESIZE_N", XC_top_side},[m + { "RESIZE_S", XC_bottom_side},[m + { "RESIZE_NS", XC_sb_v_double_arrow},[m +[32m+[m[32m { "SPLITTER_HORIZ", XC_sb_v_double_arrow},[m + { "RESIZE_W", XC_left_side},[m + { "RESIZE_E", XC_right_side},[m + { "RESIZE_WE", XC_sb_h_double_arrow},[m +[32m+[m[32m { "SPLITTER_VERT", XC_sb_h_double_arrow},[m + { "RESIZE_NE", XC_top_right_corner},[m + { "RESIZE_SE", XC_bottom_right_corner},[m + { "RESIZE_NW", XC_top_left_corner},[m +[1mdiff --git a/iup/src/mot/iupmot_dialog.c b/iup/src/mot/iupmot_dialog.c[m +[1mindex 4eeb834..7a27d74 100755[m +[1m--- a/iup/src/mot/iupmot_dialog.c[m +[1m+++ b/iup/src/mot/iupmot_dialog.c[m +[36m@@ -134,12 +134,13 @@[m [mvoid iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu[m + static int native_border = 0;[m + static int native_caption = 0;[m + [m +[31m- int has_caption = iupAttribGetBoolean(ih, "MAXBOX") ||[m +[31m- iupAttribGetBoolean(ih, "MINBOX") ||[m +[31m- iupAttribGetBoolean(ih, "MENUBOX") || [m +[31m- IupGetAttribute(ih, "TITLE"); /* must use IupGetAttribute to check from the native implementation */[m +[32m+[m[32m int has_titlebar = iupAttribGetBoolean(ih, "RESIZE") || /* GTK and Motif only */[m +[32m+[m[32m iupAttribGetBoolean(ih, "MAXBOX") ||[m +[32m+[m[32m iupAttribGetBoolean(ih, "MINBOX") ||[m +[32m+[m[32m iupAttribGetBoolean(ih, "MENUBOX") ||[m[41m [m +[32m+[m[32m IupGetAttribute(ih, "TITLE"); /* must use IupGetAttribute to check from the native implementation */[m + [m +[31m- int has_border = has_caption ||[m +[32m+[m[32m int has_border = has_titlebar ||[m + iupAttribGetBoolean(ih, "RESIZE") ||[m + iupAttribGetBoolean(ih, "BORDER");[m + [m +[36m@@ -155,7 +156,7 @@[m [mvoid iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu[m + *border = win_border;[m + [m + *caption = 0;[m +[31m- if (has_caption)[m +[32m+[m[32m if (has_titlebar)[m + *caption = win_caption;[m + [m + if (!native_border && *border)[m +[36m@@ -181,7 +182,7 @@[m [mvoid iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu[m + }[m + [m + *caption = 0;[m +[31m- if (has_caption)[m +[32m+[m[32m if (has_titlebar)[m + {[m + if (native_caption)[m + *caption = native_caption;[m +[36m@@ -853,6 +854,7 @@[m [mstatic int motDialogMapMethod(Ihandle* ih)[m + InativeHandle* parent;[m + int mwm_decor = 0;[m + int num_args = 0;[m +[32m+[m[32m int has_titlebar = 0;[m + Arg args[20];[m + [m + if (iupAttribGetBoolean(ih, "DIALOGFRAME")) [m +[36m@@ -867,32 +869,46 @@[m [mstatic int motDialogMapMethod(Ihandle* ih)[m + /****************************/[m + [m + if (iupAttribGet(ih, "TITLE"))[m +[31m- mwm_decor |= MWM_DECOR_TITLE;[m +[32m+[m[32m has_titlebar = 1;[m + if (iupAttribGetBoolean(ih, "MENUBOX"))[m +[31m- mwm_decor |= MWM_DECOR_MENU;[m +[32m+[m[32m {[m +[32m+[m[32m mwm_decor |= MWM_DECOR_MENU;[m +[32m+[m[32m has_titlebar = 1;[m +[32m+[m[32m }[m + if (iupAttribGetBoolean(ih, "MINBOX"))[m +[31m- mwm_decor |= MWM_DECOR_MINIMIZE;[m +[32m+[m[32m {[m +[32m+[m[32m mwm_decor |= MWM_DECOR_MINIMIZE;[m +[32m+[m[32m has_titlebar = 1;[m +[32m+[m[32m }[m + if (iupAttribGetBoolean(ih, "MAXBOX"))[m +[31m- mwm_decor |= MWM_DECOR_MAXIMIZE;[m +[32m+[m[32m {[m +[32m+[m[32m mwm_decor |= MWM_DECOR_MAXIMIZE;[m +[32m+[m[32m has_titlebar = 1;[m +[32m+[m[32m }[m + if (iupAttribGetBoolean(ih, "RESIZE"))[m +[31m- mwm_decor |= MWM_DECOR_RESIZEH;[m +[31m- if (iupAttribGetBoolean(ih, "BORDER"))[m +[31m- mwm_decor |= MWM_DECOR_BORDER;[m +[31m-[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* so XtRealizeWidget will not show the dialog */[m +[31m- iupmotSetArg(args, num_args, XmNdeleteResponse, XmDO_NOTHING);[m +[31m- iupmotSetArg(args, num_args, XmNallowShellResize, True); /* Used so the BulletinBoard can control the shell size */[m +[31m- iupmotSetArg(args, num_args, XmNtitle, "");[m +[31m- iupmotSetArg(args, num_args, XmNvisual, iupmot_visual);[m +[32m+[m[32m {[m +[32m+[m[32m mwm_decor |= MWM_DECOR_RESIZEH;[m +[32m+[m[32m mwm_decor |= MWM_DECOR_BORDER; /* has_border */[m +[32m+[m[32m }[m +[32m+[m[32m if (has_titlebar)[m +[32m+[m[32m mwm_decor |= MWM_DECOR_TITLE;[m +[32m+[m[32m if (iupAttribGetBoolean(ih, "BORDER") || has_titlebar)[m[41m [m +[32m+[m[32m mwm_decor |= MWM_DECOR_BORDER; /* has_border */[m +[32m+[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* so XtRealizeWidget will not show the dialog */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNdeleteResponse, XmDO_NOTHING);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNallowShellResize, True); /* Used so the BulletinBoard can control the shell size */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtitle, "");[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNvisual, iupmot_visual);[m + [m + if (iupmotColorMap()) [m +[31m- iupmotSetArg(args, num_args, XmNcolormap, iupmotColorMap());[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNcolormap, iupmotColorMap());[m + [m + if (mwm_decor != 0x7E) [m +[31m- iupmotSetArg(args, num_args, XmNmwmDecorations, mwm_decor);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmwmDecorations, mwm_decor);[m + [m + if (iupAttribGetBoolean(ih, "SAVEUNDER"))[m +[31m- iupmotSetArg(args, num_args, XmNsaveUnder, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsaveUnder, True);[m + [m + parent = iupDialogGetNativeParent(ih);[m + if (parent)[m +[1mdiff --git a/iup/src/mot/iupmot_drv.h b/iup/src/mot/iupmot_drv.h[m +[1mindex 8a536ef..424ae9f 100755[m +[1m--- a/iup/src/mot/iupmot_drv.h[m +[1m+++ b/iup/src/mot/iupmot_drv.h[m +[36m@@ -65,7 +65,7 @@[m [mvoid iupmotGetWindowSize(Ihandle *ih, int *width, int *height);[m + [m + char* iupmotGetXWindowAttrib(Ihandle *ih);[m + [m +[31m-#define iupmotSetArg(_a, _i, _n, _d) ((_a)[(_i)].name = (_n), (_a)[(_i)].value = (XtArgVal)(_d), (_i)++)[m +[32m+[m[32m#define iupMOT_SETARG(_a, _i, _n, _d) ((_a)[(_i)].name = (_n), (_a)[(_i)].value = (XtArgVal)(_d), (_i)++)[m + [m + [m + #ifdef __cplusplus[m +[1mdiff --git a/iup/src/mot/iupmot_filedlg.c b/iup/src/mot/iupmot_filedlg.c[m +[1mindex 768dd2b..0be6319 100755[m +[1m--- a/iup/src/mot/iupmot_filedlg.c[m +[1m+++ b/iup/src/mot/iupmot_filedlg.c[m +[36m@@ -17,6 +17,7 @@[m + #include <Xm/DrawingA.h>[m + #include <Xm/PushB.h>[m + #include <Xm/Frame.h>[m +[32m+[m[32m#include <Xm/List.h>[m + [m + #include "iup.h"[m + #include "iupcbs.h"[m +[36m@@ -28,6 +29,7 @@[m + #include "iup_dialog.h"[m + #include "iup_strmessage.h"[m + #include "iup_drvinfo.h"[m +[32m+[m[32m#include "iup_array.h"[m + [m + #include "iupmot_drv.h"[m + [m +[36m@@ -87,14 +89,14 @@[m [mstatic int motFileDlgCheckValue(Ihandle* ih, Widget w)[m + return 0;[m + }[m + }[m +[31m- else[m +[32m+[m[32m else if (!iupAttribGetBoolean(ih, "MULTIPLEFILES"))[m + {[m + if (iupdrvIsDirectory(value)) /* selected a directory */[m + {[m + iupStrMessageShowError(ih, "IUP_INVALIDDIR");[m + return 0;[m + }[m +[31m- else if (!iupdrvIsFile(value)) /* new file */[m +[32m+[m[32m else if (!iupdrvIsFile(value)) /* not a file == new file */[m + {[m + value = iupAttribGet(ih, "ALLOWNEW");[m + if (!value)[m +[36m@@ -132,6 +134,51 @@[m [mstatic void motFileDlgCBclose(Widget w, XtPointer client_data, XtPointer call_da[m + iupAttribSetStr(ih, "_IUP_WM_DELETE", "1");[m + }[m + [m +[32m+[m[32mstatic int motFileDlgGetMultipleFiles(Ihandle* ih, const char* dir, Widget wList)[m +[32m+[m[32m{[m +[32m+[m[32m int *pos, sel_count, dir_len;[m +[32m+[m[32m int i, len, cur_len;[m +[32m+[m[32m char *filename, *all_names;[m +[32m+[m[32m Iarray* names_array;[m +[32m+[m[32m XmString* items;[m +[32m+[m +[32m+[m[32m if (!XmListGetSelectedPos(wList, &pos, &sel_count))[m +[32m+[m[32m return 0;[m +[32m+[m +[32m+[m[32m names_array = iupArrayCreate(1024, 1); /* just set an initial size, but count is 0 */[m +[32m+[m[32m XtVaGetValues(wList, XmNitems, &items, NULL);[m +[32m+[m +[32m+[m[32m cur_len = strlen(dir);[m +[32m+[m +[32m+[m[32m all_names = iupArrayAdd(names_array, cur_len+1);[m +[32m+[m[32m memcpy(all_names, dir, cur_len);[m +[32m+[m[32m all_names[cur_len] = '|';[m +[32m+[m[32m dir_len = cur_len;[m +[32m+[m[32m cur_len++; /* skip separator */[m +[32m+[m +[32m+[m[32m for (i = 0; i<sel_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m filename = iupmotConvertString(items[pos[i]-1]); /* XmListGetSelectedPos starts at 1 */[m +[32m+[m[32m len = strlen(filename)-dir_len;[m +[32m+[m +[32m+[m[32m cur_len = iupArrayCount(names_array);[m +[32m+[m[32m all_names = iupArrayAdd(names_array, len+1);[m +[32m+[m[32m memcpy(all_names+cur_len, filename+dir_len, len);[m +[32m+[m[32m all_names[cur_len+len] = '|';[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m XtFree((char*)pos);[m +[32m+[m +[32m+[m[32m cur_len = iupArrayCount(names_array);[m +[32m+[m[32m all_names = iupArrayInc(names_array);[m +[32m+[m[32m all_names[cur_len+1] = 0;[m +[32m+[m +[32m+[m[32m iupAttribStoreStr(ih, "VALUE", all_names);[m +[32m+[m +[32m+[m[32m iupArrayDestroy(names_array);[m +[32m+[m[32m return 1;[m +[32m+[m[32m}[m +[32m+[m + static void motFileDlgCallback(Widget w, Ihandle* ih, XmFileSelectionBoxCallbackStruct* call_data)[m + {[m + (void)w;[m +[36m@@ -151,14 +198,38 @@[m [mstatic void motFileDlgCallback(Widget w, Ihandle* ih, XmFileSelectionBoxCallback[m + iupAttribSetStr(ih, "STATUS", "0");[m + iupAttribSetStr(ih, "FILEEXIST", NULL);[m + }[m +[32m+[m[32m else if (iupAttribGetBoolean(ih, "MULTIPLEFILES"))[m +[32m+[m[32m {[m +[32m+[m[32m Widget wList = XmFileSelectionBoxGetChild(w, XmDIALOG_LIST);[m +[32m+[m +[32m+[m[32m /* VALUE obtained above contains exactly the DIRECTORY */[m +[32m+[m[32m char* dir = iupAttribGet(ih, "VALUE");[m +[32m+[m[32m int len = strlen(dir);[m +[32m+[m[32m if (dir[len-1]=='/') dir[len-1] = 0; /* remove last '/' */[m +[32m+[m[32m iupAttribStoreStr(ih, "DIRECTORY", dir);[m +[32m+[m +[32m+[m[32m if (!motFileDlgGetMultipleFiles(ih, iupAttribGet(ih, "DIRECTORY"), wList))[m +[32m+[m[32m {[m +[32m+[m[32m iupStrMessageShowError(ih, "IUP_FILENOTEXIST");[m +[32m+[m[32m return;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "STATUS", "0");[m +[32m+[m[32m iupAttribSetStr(ih, "FILEEXIST", "YES");[m +[32m+[m[32m }[m + else[m + {[m + IFnss file_cb = (IFnss)IupGetCallback(ih, "FILE_CB");[m +[31m- if (file_cb && file_cb(ih, iupAttribGet(ih, "VALUE"), "OK") == IUP_IGNORE)[m +[32m+[m[32m filename = iupAttribGet(ih, "VALUE");[m +[32m+[m[32m if (file_cb && file_cb(ih, filename, "OK") == IUP_IGNORE)[m + return;[m + [m +[31m- if (iupdrvIsFile(iupAttribGet(ih, "VALUE"))) /* check if file exists */[m +[32m+[m[32m if (iupdrvIsFile(filename)) /* check if file exists */[m + {[m +[32m+[m[32m char* dir = iupStrFileGetPath(filename);[m +[32m+[m[32m iupAttribStoreStr(ih, "DIRECTORY", dir);[m +[32m+[m[32m free(dir);[m +[32m+[m + iupAttribSetStr(ih, "FILEEXIST", "YES");[m + iupAttribSetStr(ih, "STATUS", "0");[m + }[m +[36m@@ -188,9 +259,8 @@[m [mstatic void motFileDlgCallback(Widget w, Ihandle* ih, XmFileSelectionBoxCallback[m + }[m + }[m + [m +[31m-static void motFileDlgHelpCallback(Widget w, XtPointer client_data, XtPointer call_data)[m +[32m+[m[32mstatic void motFileDlgHelpCallback(Widget w, Ihandle *ih, XtPointer call_data)[m + {[m +[31m- Ihandle *ih = (Ihandle*)client_data;[m + Icallback cb = IupGetCallback(ih, "HELP_CB");[m + if (cb && cb(ih) == IUP_CLOSE)[m + {[m +[36m@@ -340,14 +410,15 @@[m [mstatic void motFileDlgPreviewCanvasExposeCallback(Widget w, Ihandle *ih, XtPoint[m + static void motFileDlgBrowseSelectionCallback(Widget w, Ihandle* ih, XmListCallbackStruct* list_data)[m + {[m + char* filename;[m +[32m+[m[32m IFnss cb;[m + [m + XmStringGetLtoR(list_data->item, XmSTRING_DEFAULT_CHARSET, &filename);[m + [m +[32m+[m[32m cb = (IFnss)IupGetCallback(ih, "FILE_CB");[m + if (iupdrvIsFile(filename))[m +[31m- {[m +[31m- IFnss cb = (IFnss)IupGetCallback(ih, "FILE_CB");[m + cb(ih, filename, "SELECT");[m +[31m- }[m +[32m+[m[32m else[m +[32m+[m[32m cb(ih, filename, "OTHER");[m + [m + XtFree(filename);[m + (void)w;[m +[36m@@ -417,6 +488,13 @@[m [mstatic int motFileDlgPopup(Ihandle* ih, int x, int y)[m + if (dialogtype == IUP_DIALOGDIR)[m + XtVaSetValues(filebox, XmNfileTypeMask, XmFILE_DIRECTORY, NULL);[m + [m +[32m+[m[32m if (iupAttribGetBoolean(ih, "MULTIPLEFILES"))[m +[32m+[m[32m {[m +[32m+[m[32m Widget wList = XmFileSelectionBoxGetChild(filebox, XmDIALOG_LIST);[m +[32m+[m[32m XtVaSetValues(wList, XmNselectionPolicy, XmEXTENDED_SELECT, NULL);[m +[32m+[m[32m XtAddCallback(wList, XmNextendedSelectionCallback, (XtCallbackProc)motFileDlgBrowseSelectionCallback, (XtPointer)ih);[m +[32m+[m[32m }[m +[32m+[m + /* just check for the path inside FILE */[m + value = iupAttribGet(ih, "FILE");[m + if (value && value[0] == '/')[m +[36m@@ -501,8 +579,10 @@[m [mstatic int motFileDlgPopup(Ihandle* ih, int x, int y)[m + file_cb = (IFnss)IupGetCallback(ih, "FILE_CB");[m + if (file_cb)[m + {[m +[31m- Widget file_list = XmFileSelectionBoxGetChild(filebox, XmDIALOG_LIST);[m +[31m- XtAddCallback(file_list, XmNbrowseSelectionCallback, (XtCallbackProc)motFileDlgBrowseSelectionCallback, (XtPointer)ih);[m +[32m+[m[32m Widget list = XmFileSelectionBoxGetChild(filebox, XmDIALOG_LIST);[m +[32m+[m[32m XtAddCallback(list, XmNbrowseSelectionCallback, (XtCallbackProc)motFileDlgBrowseSelectionCallback, (XtPointer)ih);[m +[32m+[m[32m list = XmFileSelectionBoxGetChild(filebox, XmDIALOG_DIR_LIST);[m +[32m+[m[32m XtAddCallback(list, XmNbrowseSelectionCallback, (XtCallbackProc)motFileDlgBrowseSelectionCallback, (XtPointer)ih);[m + [m + if (iupAttribGetBoolean(ih, "SHOWPREVIEW"))[m + {[m +[36m@@ -575,4 +655,6 @@[m [mstatic int motFileDlgPopup(Ihandle* ih, int x, int y)[m + void iupdrvFileDlgInitClass(Iclass* ic)[m + {[m + ic->DlgPopup = motFileDlgPopup;[m +[32m+[m +[32m+[m[32m iupClassRegisterAttribute(ic, "MULTIPLEFILES", NULL, NULL, NULL, NULL, IUPAF_NO_INHERIT);[m + }[m +[1mdiff --git a/iup/src/mot/iupmot_font.c b/iup/src/mot/iupmot_font.c[m +[1mindex 8da06dd..42154b6 100755[m +[1m--- a/iup/src/mot/iupmot_font.c[m +[1m+++ b/iup/src/mot/iupmot_font.c[m +[36m@@ -135,19 +135,19 @@[m [mstatic XmFontList motFontCreateRenderTable(XFontStruct* fontstruct, int is_under[m + Arg args[10];[m + int num_args = 0;[m + [m +[31m- iupmotSetArg(args, num_args, XmNfontType, XmFONT_IS_FONT);[m +[31m- iupmotSetArg(args, num_args, XmNfont, (XtPointer)fontstruct);[m +[31m- iupmotSetArg(args, num_args, XmNloadModel, XmLOAD_IMMEDIATE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNfontType, XmFONT_IS_FONT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNfont, (XtPointer)fontstruct);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNloadModel, XmLOAD_IMMEDIATE);[m + [m + if (is_underline)[m +[31m- iupmotSetArg(args, num_args, XmNunderlineType, XmSINGLE_LINE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNunderlineType, XmSINGLE_LINE);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNunderlineType, XmNO_LINE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNunderlineType, XmNO_LINE);[m + [m + if (is_strikeout)[m +[31m- iupmotSetArg(args, num_args, XmNstrikethruType, XmSINGLE_LINE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNstrikethruType, XmSINGLE_LINE);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNstrikethruType, XmNO_LINE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNstrikethruType, XmNO_LINE);[m + [m + rendition = XmRenditionCreate(NULL, "", args, num_args);[m + [m +[1mdiff --git a/iup/src/mot/iupmot_frame.c b/iup/src/mot/iupmot_frame.c[m +[1mindex 39de5d8..cfda44f 100755[m +[1m--- a/iup/src/mot/iupmot_frame.c[m +[1m+++ b/iup/src/mot/iupmot_frame.c[m +[36m@@ -42,22 +42,33 @@[m [mstatic int motFrameSetBgColorAttrib(Ihandle* ih, const char* value)[m + {[m + Pixel color;[m + [m +[31m- /* ignore given value, must use only from parent */[m +[31m- value = iupBaseNativeParentGetBgColor(ih);[m +[32m+[m[32m if (!iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR"))[m +[32m+[m[32m {[m +[32m+[m[32m /* ignore given value, must use only from parent */[m +[32m+[m[32m value = iupBaseNativeParentGetBgColor(ih);[m +[32m+[m[32m }[m + [m + color = iupmotColorGetPixelStr(value);[m + if (color != (Pixel)-1)[m + {[m + Widget title_label, child_manager;[m + [m +[31m- iupmotSetBgColor(ih->handle, color);[m +[32m+[m[32m if (!iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR"))[m +[32m+[m[32m {[m +[32m+[m[32m iupmotSetBgColor(ih->handle, color);[m + [m +[31m- child_manager = XtNameToWidget(ih->handle, "*child_manager");[m +[31m- iupmotSetBgColor(child_manager, color);[m +[32m+[m[32m child_manager = XtNameToWidget(ih->handle, "*child_manager");[m +[32m+[m[32m iupmotSetBgColor(child_manager, color);[m + [m +[31m- title_label = XtNameToWidget(ih->handle, "*title_label");[m +[31m- if (!title_label) return 1;[m +[31m- iupmotSetBgColor(title_label, color);[m +[32m+[m[32m title_label = XtNameToWidget(ih->handle, "*title_label");[m +[32m+[m[32m if (!title_label) return 1;[m +[32m+[m[32m iupmotSetBgColor(title_label, color);[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m child_manager = XtNameToWidget(ih->handle, "*child_manager");[m +[32m+[m[32m iupmotSetBgColor(child_manager, color);[m +[32m+[m[32m }[m + [m + return 1;[m + }[m +[36m@@ -171,22 +182,25 @@[m [mstatic int motFrameMapMethod(Ihandle* ih)[m + {[m + char* value = iupAttribGetStr(ih, "SUNKEN");[m + if (iupStrBoolean(value))[m +[31m- iupmotSetArg(args, num_args, XmNshadowType, XmSHADOW_IN); [m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowType, XmSHADOW_IN);[m[41m [m + else[m +[31m- iupmotSetArg(args, num_args, XmNshadowType, XmSHADOW_ETCHED_IN); [m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowType, XmSHADOW_ETCHED_IN);[m[41m [m +[32m+[m +[32m+[m[32m if (iupAttribGet(ih, "BGCOLOR"))[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPFRAME_HAS_BGCOLOR", "1");[m + }[m + [m + /* Core */[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + /* Manager */[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 2);[m + /* Frame */[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* no shadow margins */[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0); /* no shadow margins */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* no shadow margins */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0); /* no shadow margins */[m + [m + ih->handle = XtCreateManagedWidget([m + iupDialogGetChildIdStr(ih), /* child identifier */[m +[36m@@ -204,11 +218,11 @@[m [mstatic int motFrameMapMethod(Ihandle* ih)[m + Widget title_label;[m + num_args = 0;[m + /* Label */[m +[31m- iupmotSetArg(args, num_args, XmNlabelType, XmSTRING); [m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelType, XmSTRING);[m[41m [m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m + /* Frame Constraint */[m +[31m- iupmotSetArg(args, num_args, XmNchildType, XmFRAME_TITLE_CHILD);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNchildType, XmFRAME_TITLE_CHILD);[m + title_label = XtCreateManagedWidget("title_label", xmLabelWidgetClass, ih->handle, args, num_args);[m + iupmotSetString(title_label, XmNlabelString, title);[m + }[m +[1mdiff --git a/iup/src/mot/iupmot_key.c b/iup/src/mot/iupmot_key.c[m +[1mindex 835b5d7..9897741 100755[m +[1m--- a/iup/src/mot/iupmot_key.c[m +[1m+++ b/iup/src/mot/iupmot_key.c[m +[36m@@ -393,33 +393,33 @@[m [mvoid iupmotKeyPressEvent(Widget w, Ihandle *ih, XEvent *evt, Boolean *cont)[m + void iupmotButtonKeySetStatus(unsigned int state, unsigned int but, char* status, int doubleclick)[m + {[m + if (state & ShiftMask)[m +[31m- iupKEYSETSHIFT(status);[m +[32m+[m[32m iupKEY_SETSHIFT(status);[m + [m + if (state & ControlMask)[m +[31m- iupKEYSETCONTROL(status); [m +[32m+[m[32m iupKEY_SETCONTROL(status);[m[41m [m + [m + if ((state & Button1Mask) || but==Button1)[m +[31m- iupKEYSETBUTTON1(status);[m +[32m+[m[32m iupKEY_SETBUTTON1(status);[m + [m + if ((state & Button2Mask) || but==Button2)[m +[31m- iupKEYSETBUTTON2(status);[m +[32m+[m[32m iupKEY_SETBUTTON2(status);[m + [m + if ((state & Button3Mask) || but==Button3)[m +[31m- iupKEYSETBUTTON3(status);[m +[32m+[m[32m iupKEY_SETBUTTON3(status);[m + [m + if ((state & Button4Mask) || but==Button4)[m +[31m- iupKEYSETBUTTON4(status);[m +[32m+[m[32m iupKEY_SETBUTTON4(status);[m + [m + if ((state & Button5Mask) || but==Button5)[m +[31m- iupKEYSETBUTTON5(status);[m +[32m+[m[32m iupKEY_SETBUTTON5(status);[m + [m + if (state & Mod1Mask || state & Mod5Mask) /* Alt */[m +[31m- iupKEYSETALT(status);[m +[32m+[m[32m iupKEY_SETALT(status);[m + [m + if (state & Mod4Mask) /* Apple/Win */[m +[31m- iupKEYSETSYS(status);[m +[32m+[m[32m iupKEY_SETSYS(status);[m + [m + if (doubleclick)[m +[31m- iupKEYSETDOUBLE(status);[m +[32m+[m[32m iupKEY_SETDOUBLE(status);[m + }[m + [m +[1mdiff --git a/iup/src/mot/iupmot_label.c b/iup/src/mot/iupmot_label.c[m +[1mindex 52dfc9a..afff3c3 100755[m +[1m--- a/iup/src/mot/iupmot_label.c[m +[1m+++ b/iup/src/mot/iupmot_label.c[m +[36m@@ -147,8 +147,10 @@[m [mstatic int motLabelSetPaddingAttrib(Ihandle* ih, const char* value)[m + {[m + XtVaSetValues(ih->handle, XmNmarginHeight, ih->data->vert_padding,[m + XmNmarginWidth, ih->data->horiz_padding, NULL);[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int motLabelMapMethod(Ihandle* ih)[m +[36m@@ -165,12 +167,12 @@[m [mstatic int motLabelMapMethod(Ihandle* ih)[m + if (iupStrEqualNoCase(value, "HORIZONTAL"))[m + {[m + ih->data->type = IUP_LABEL_SEP_HORIZ;[m +[31m- iupmotSetArg(args, num_args, XmNorientation, XmHORIZONTAL);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNorientation, XmHORIZONTAL);[m + }[m + else /* "VERTICAL" */[m + {[m + ih->data->type = IUP_LABEL_SEP_VERT;[m +[31m- iupmotSetArg(args, num_args, XmNorientation, XmVERTICAL);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNorientation, XmVERTICAL);[m + }[m + }[m + else[m +[36m@@ -180,32 +182,32 @@[m [mstatic int motLabelMapMethod(Ihandle* ih)[m + if (value)[m + {[m + ih->data->type = IUP_LABEL_IMAGE;[m +[31m- iupmotSetArg(args, num_args, XmNlabelType, XmPIXMAP); [m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelType, XmPIXMAP);[m[41m [m + }[m + else[m + {[m + ih->data->type = IUP_LABEL_TEXT;[m +[31m- iupmotSetArg(args, num_args, XmNlabelType, XmSTRING); [m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelType, XmSTRING);[m[41m [m + }[m + }[m + [m + /* Core */[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + /* Primitive */[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 0);[m + /* Label */[m +[31m- iupmotSetArg(args, num_args, XmNrecomputeSize, False); /* no automatic resize from text */[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginTop, 0); /* no extra margins */[m +[31m- iupmotSetArg(args, num_args, XmNmarginLeft, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginBottom, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginRight, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNrecomputeSize, False); /* no automatic resize from text */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginTop, 0); /* no extra margins */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginLeft, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginBottom, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginRight, 0);[m + [m + ih->handle = XtCreateManagedWidget([m + iupDialogGetChildIdStr(ih), /* child identifier */[m +[1mdiff --git a/iup/src/mot/iupmot_list.c b/iup/src/mot/iupmot_list.c[m +[1mindex f8e73ed..800e6e9 100755[m +[1m--- a/iup/src/mot/iupmot_list.c[m +[1m+++ b/iup/src/mot/iupmot_list.c[m +[36m@@ -143,15 +143,36 @@[m [mvoid iupdrvListInsertItem(Ihandle* ih, int pos, const char* value)[m + motListAddSortedItem(ih, value);[m + else[m + motListAddItem(ih, pos, value);[m +[32m+[m +[32m+[m[32m iupListUpdateOldValue(ih, pos, 0);[m + }[m + [m + void iupdrvListRemoveItem(Ihandle* ih, int pos)[m + {[m + /* The utility functions use 0=last 1=first */[m + if (ih->data->is_dropdown || ih->data->has_editbox)[m +[32m+[m[32m {[m +[32m+[m[32m if (ih->data->is_dropdown && !ih->data->has_editbox)[m +[32m+[m[32m {[m +[32m+[m[32m /* must check if removing the current item */[m +[32m+[m[32m int curpos;[m +[32m+[m[32m XtVaGetValues(ih->handle, XmNselectedPosition, &curpos, NULL);[m +[32m+[m[32m if (pos == curpos && iupdrvListGetCount(ih)>1)[m +[32m+[m[32m {[m +[32m+[m[32m if (curpos > 0) curpos--;[m +[32m+[m[32m else curpos++;[m +[32m+[m +[32m+[m[32m XtRemoveCallback(ih->handle, XmNselectionCallback, (XtCallbackProc)motListComboBoxSelectionCallback, (XtPointer)ih);[m +[32m+[m[32m XtVaSetValues(ih->handle, XmNselectedPosition, curpos, NULL);[m[41m [m +[32m+[m[32m XtAddCallback(ih->handle, XmNselectionCallback, (XtCallbackProc)motListComboBoxSelectionCallback, (XtPointer)ih);[m +[32m+[m[32m }[m +[32m+[m[32m }[m + XmComboBoxDeletePos(ih->handle, pos+1);[m +[32m+[m[32m }[m + else[m + XmListDeletePos(ih->handle, pos+1);[m +[32m+[m +[32m+[m[32m iupListUpdateOldValue(ih, pos, 1);[m + }[m + [m + void iupdrvListRemoveAllItems(Ihandle* ih)[m +[36m@@ -174,7 +195,7 @@[m [mvoid iupdrvListRemoveAllItems(Ihandle* ih)[m + static char* motListGetIdValueAttrib(Ihandle* ih, const char* name_id)[m + {[m + int pos = iupListGetPos(ih, name_id);[m +[31m- if (pos != -1)[m +[32m+[m[32m if (pos >= 0)[m + {[m + XmString* items;[m + XtVaGetValues(ih->handle, XmNitems, &items, NULL);[m +[36m@@ -852,8 +873,10 @@[m [mstatic int motListSetNCAttrib(Ihandle* ih, const char* value)[m + Widget cbedit;[m + XtVaGetValues(ih->handle, XmNtextField, &cbedit, NULL);[m + XtVaSetValues(cbedit, XmNmaxLength, ih->data->nc, NULL);[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int motListSetClipboardAttrib(Ihandle *ih, const char *value)[m +[36m@@ -1181,32 +1204,32 @@[m [mstatic int motListMapMethod(Ihandle* ih)[m + if (ih->data->is_dropdown || ih->data->has_editbox)[m + {[m + /* could not set XmNmappedWhenManaged to False because the list and the edit box where not displayed */[m +[31m- /* iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); */[m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m /* iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m + [m + if (iupAttribGetBoolean(ih, "CANFOCUS"))[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m + [m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 2);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 2);[m + [m + if (ih->data->has_editbox)[m + {[m + if (ih->data->is_dropdown)[m +[31m- iupmotSetArg(args, num_args, XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); /* hidden-list+edit */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); /* hidden-list+edit */[m + else[m +[31m- iupmotSetArg(args, num_args, XmNcomboBoxType, XmCOMBO_BOX); /* visible-list+edit */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNcomboBoxType, XmCOMBO_BOX); /* visible-list+edit */[m + }[m + else[m +[31m- iupmotSetArg(args, num_args, XmNcomboBoxType, XmDROP_DOWN_LIST); /* hidden-list */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNcomboBoxType, XmDROP_DOWN_LIST); /* hidden-list */[m + [m + ih->handle = XtCreateManagedWidget([m + child_id, /* child identifier */[m +[36m@@ -1220,13 +1243,13 @@[m [mstatic int motListMapMethod(Ihandle* ih)[m + [m + /* Create the scrolled window */[m + [m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNscrollingPolicy, XmAPPLICATION_DEFINED);[m +[31m- iupmotSetArg(args, num_args, XmNvisualPolicy, XmVARIABLE);[m +[31m- iupmotSetArg(args, num_args, XmNscrollBarDisplayPolicy, XmSTATIC); /* can NOT be XmAS_NEEDED because XmAPPLICATION_DEFINED */[m +[31m- iupmotSetArg(args, num_args, XmNspacing, 0); /* no space between scrollbars and text */[m +[31m- iupmotSetArg(args, num_args, XmNborderWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollingPolicy, XmAPPLICATION_DEFINED);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNvisualPolicy, XmVARIABLE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollBarDisplayPolicy, XmSTATIC); /* can NOT be XmAS_NEEDED because XmAPPLICATION_DEFINED */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNspacing, 0); /* no space between scrollbars and text */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNborderWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m + [m + sb_win = XtCreateManagedWidget([m + child_id, /* child identifier */[m +[36m@@ -1243,34 +1266,34 @@[m [mstatic int motListMapMethod(Ihandle* ih)[m + /* Create the list */[m + [m + num_args = 0;[m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + [m + if (iupAttribGetBoolean(ih, "CANFOCUS"))[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m + [m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 2);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 2);[m + [m +[31m- iupmotSetArg(args, num_args, XmNlistMarginHeight, 0); /* default padding */[m +[31m- iupmotSetArg(args, num_args, XmNlistMarginWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNlistSpacing, 0);[m +[31m- iupmotSetArg(args, num_args, XmNlistSizePolicy, XmCONSTANT); /* don't grow to fit, add scrollbar */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlistMarginHeight, 0); /* default padding */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlistMarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlistSpacing, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlistSizePolicy, XmCONSTANT); /* don't grow to fit, add scrollbar */[m + [m + if (ih->data->is_multiple)[m +[31m- iupmotSetArg(args, num_args, XmNselectionPolicy, XmEXTENDED_SELECT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNselectionPolicy, XmEXTENDED_SELECT);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNselectionPolicy, XmBROWSE_SELECT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNselectionPolicy, XmBROWSE_SELECT);[m + [m + if (iupAttribGetBoolean(ih, "AUTOHIDE"))[m +[31m- iupmotSetArg(args, num_args, XmNscrollBarDisplayPolicy, XmAS_NEEDED);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollBarDisplayPolicy, XmAS_NEEDED);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNscrollBarDisplayPolicy, XmSTATIC);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollBarDisplayPolicy, XmSTATIC);[m + [m + ih->handle = XtCreateManagedWidget([m + child_id, /* child identifier */[m +[1mdiff --git a/iup/src/mot/iupmot_loop.c b/iup/src/mot/iupmot_loop.c[m +[1mindex 828ddcd..c1f92ec 100755[m +[1m--- a/iup/src/mot/iupmot_loop.c[m +[1m+++ b/iup/src/mot/iupmot_loop.c[m +[36m@@ -56,7 +56,7 @@[m [mvoid iupdrvSetIdleFunction(Icallback f)[m + mot_idle_id = XtAppAddWorkProc(iupmot_appcontext, motIdlecbWorkProc, NULL);[m + }[m + [m +[31m-static int motLoopStep(void)[m +[32m+[m[32mstatic int motLoopProcessEvent(void)[m + {[m + XtAppProcessEvent(iupmot_appcontext, XtIMAll);[m + return (mot_exitmainloop)? IUP_CLOSE : IUP_DEFAULT;[m +[36m@@ -79,7 +79,7 @@[m [mint IupMainLoop(void)[m + [m + while (!mot_exitmainloop)[m + {[m +[31m- if (motLoopStep() == IUP_CLOSE)[m +[32m+[m[32m if (motLoopProcessEvent() == IUP_CLOSE)[m + break;[m + }[m + [m +[36m@@ -88,19 +88,26 @@[m [mint IupMainLoop(void)[m + return IUP_NOERROR;[m + }[m + [m +[32m+[m[32mint IupLoopStepWait(void)[m +[32m+[m[32m{[m +[32m+[m[32m while(!XtAppPending(iupmot_appcontext));[m +[32m+[m +[32m+[m[32m return motLoopProcessEvent();[m +[32m+[m[32m}[m +[32m+[m + int IupLoopStep(void)[m + {[m + if (!XtAppPending(iupmot_appcontext)) [m + return IUP_DEFAULT;[m + [m +[31m- return motLoopStep();[m +[32m+[m[32m return motLoopProcessEvent();[m + }[m + [m + void IupFlush(void)[m + {[m + while (XPending(iupmot_display) != 0)[m + {[m +[31m- if (motLoopStep() == IUP_CLOSE)[m +[32m+[m[32m if (motLoopProcessEvent() == IUP_CLOSE)[m + break;[m + }[m + [m +[1mdiff --git a/iup/src/mot/iupmot_menu.c b/iup/src/mot/iupmot_menu.c[m +[1mindex be9b953..8f51334 100755[m +[1m--- a/iup/src/mot/iupmot_menu.c[m +[1m+++ b/iup/src/mot/iupmot_menu.c[m +[36m@@ -125,7 +125,10 @@[m [mstatic void motPopupMenuUnmapCallback(Widget w, Ihandle* ih, XtPointer call_data[m + static void motMenuUnMapMethod(Ihandle* ih)[m + {[m + if (iupMenuIsMenuBar(ih))[m +[32m+[m[32m {[m + XtDestroyWidget(ih->handle);[m +[32m+[m[32m ih->parent = NULL;[m +[32m+[m[32m }[m + else[m + XtDestroyWidget(XtParent(ih->handle)); /* in this case the RowColumn widget is a child of a MenuShell. */[m + }[m +[36m@@ -146,7 +149,6 @@[m [mstatic int motMenuMapMethod(Ihandle* ih)[m + XmNrowColumnType, XmMENU_BAR,[m + XmNmarginHeight, 0,[m + XmNmarginWidth, 0,[m +[31m- XmNresizeWidth, False,[m + NULL);[m + if (!ih->handle)[m + return IUP_ERROR;[m +[36m@@ -161,8 +163,8 @@[m [mstatic int motMenuMapMethod(Ihandle* ih)[m + [m + if (iupAttribGetBoolean(ih, "RADIO"))[m + {[m +[31m- iupmotSetArg(args, num_args, XmNpacking, XmPACK_COLUMN);[m +[31m- iupmotSetArg(args, num_args, XmNradioBehavior, TRUE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNpacking, XmPACK_COLUMN);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNradioBehavior, TRUE);[m + }[m + [m + ih->handle = XmCreatePulldownMenu([m +[36m@@ -183,7 +185,7 @@[m [mstatic int motMenuMapMethod(Ihandle* ih)[m + {[m + /* top level menu used for IupPopup */[m + [m +[31m- iupmotSetArg(args, num_args, XmNpopupEnabled, XmPOPUP_AUTOMATIC);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNpopupEnabled, XmPOPUP_AUTOMATIC);[m + [m + ih->handle = XmCreatePopupMenu([m + iupmot_appshell, [m +[36m@@ -307,19 +309,19 @@[m [mstatic int motItemMapMethod(Ihandle* ih)[m + [m + if (iupAttribGetBoolean(ih->parent, "RADIO"))[m + {[m +[31m- iupmotSetArg(args, num_args, XmNtoggleMode, XmTOGGLE_BOOLEAN);[m +[31m- iupmotSetArg(args, num_args, XmNindicatorType, XmONE_OF_MANY_ROUND);[m +[31m- iupmotSetArg(args, num_args, XmNindicatorOn, XmINDICATOR_CHECK_BOX);[m +[31m- iupmotSetArg(args, num_args, XmNindicatorSize, 13);[m +[31m- iupmotSetArg(args, num_args, XmNselectColor, iupmotColorGetPixel(0, 0, 0));[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtoggleMode, XmTOGGLE_BOOLEAN);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorType, XmONE_OF_MANY_ROUND);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorOn, XmINDICATOR_CHECK_BOX);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorSize, 13);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNselectColor, iupmotColorGetPixel(0, 0, 0));[m + }[m + else[m + {[m + if (iupAttribGetBoolean(ih, "HIDEMARK"))[m +[31m- iupmotSetArg(args, num_args, XmNindicatorOn, XmINDICATOR_NONE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorOn, XmINDICATOR_NONE);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNindicatorOn, XmINDICATOR_CHECK);[m +[31m- iupmotSetArg(args, num_args, XmNlabelType, iupAttribGet(ih, "TITLEIMAGE")? XmPIXMAP: XmSTRING);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorOn, XmINDICATOR_CHECK);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelType, iupAttribGet(ih, "TITLEIMAGE")? XmPIXMAP: XmSTRING);[m + }[m + [m + ih->handle = XtCreateManagedWidget([m +[1mdiff --git a/iup/src/mot/iupmot_progressbar.c b/iup/src/mot/iupmot_progressbar.c[m +[1mindex 7266d38..82fa178 100755[m +[1m--- a/iup/src/mot/iupmot_progressbar.c[m +[1m+++ b/iup/src/mot/iupmot_progressbar.c[m +[36m@@ -98,25 +98,25 @@[m [mstatic int motProgressBarMapMethod(Ihandle* ih)[m + Arg args[30];[m + [m + /* Core */[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + /* Primitive */[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 0);[m + /* Scale */[m +[31m- iupmotSetArg(args, num_args, XmNminimum, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmaximum, SHRT_MAX);[m +[31m- iupmotSetArg(args, num_args, XmNslidingMode, XmTHERMOMETER); /* thermometer effect */[m +[31m- iupmotSetArg(args, num_args, XmNsliderMark, XmNONE);[m +[31m- iupmotSetArg(args, num_args, XmNeditable, False);[m +[31m- iupmotSetArg(args, num_args, XmNshowValue, XmNONE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNminimum, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmaximum, SHRT_MAX);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNslidingMode, XmTHERMOMETER); /* thermometer effect */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsliderMark, XmNONE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNeditable, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshowValue, XmNONE);[m + [m + if (iupStrEqualNoCase(iupAttribGetStr(ih, "ORIENTATION"), "VERTICAL"))[m + {[m +[31m- iupmotSetArg(args, num_args, XmNorientation, XmVERTICAL);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNorientation, XmVERTICAL);[m + [m + if (ih->currentheight < ih->currentwidth)[m + {[m +[36m@@ -126,7 +126,7 @@[m [mstatic int motProgressBarMapMethod(Ihandle* ih)[m + }[m + }[m + else[m +[31m- iupmotSetArg(args, num_args, XmNorientation, XmHORIZONTAL);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNorientation, XmHORIZONTAL);[m + [m + ih->handle = XtCreateManagedWidget([m + iupDialogGetChildIdStr(ih), /* child identifier */[m +[1mdiff --git a/iup/src/mot/iupmot_tabs.c b/iup/src/mot/iupmot_tabs.c[m +[1mindex 7c8a6b5..cafc41d 100755[m +[1m--- a/iup/src/mot/iupmot_tabs.c[m +[1m+++ b/iup/src/mot/iupmot_tabs.c[m +[36m@@ -52,8 +52,10 @@[m [mvoid iupdrvTabsSetCurrentTab(Ihandle* ih, int pos)[m + {[m + Ihandle* child = IupGetChild(ih, pos);[m + Ihandle* prev_child = IupGetChild(ih, iupdrvTabsGetCurrentTab(ih));[m +[31m- IupSetAttribute(child, "VISIBLE", "YES");[m +[31m- IupSetAttribute(prev_child, "VISIBLE", "NO");[m +[32m+[m[32m Widget child_manager = (Widget)iupAttribGet(child, "_IUPTAB_CONTAINER");[m +[32m+[m[32m Widget prev_child_manager = (Widget)iupAttribGet(prev_child, "_IUPTAB_CONTAINER");[m +[32m+[m[32m XtMapWidget(child_manager);[m +[32m+[m[32m if (prev_child_manager) XtUnmapWidget(prev_child_manager);[m + [m + XtVaSetValues(ih->handle, XmNcurrentPageNumber, pos, NULL);[m + }[m +[36m@@ -200,7 +202,7 @@[m [mstatic int motTabsSetTabTypeAttrib(Ihandle* ih, const char* value)[m + ih->data->type = ITABS_TOP;[m + [m + if (ih->handle)[m +[31m- motTabsUpdateTabType(ih);[m +[32m+[m[32m motTabsUpdateTabType(ih); /* for this to work must be updated in map */[m + [m + return 0;[m + }[m +[36m@@ -313,8 +315,10 @@[m [mvoid motTabsPageChangedCallback(Widget w, Ihandle* ih, XmNotebookCallbackStruct[m + IFnnn cb;[m + Ihandle* child = IupGetChild(ih, nptr->page_number);[m + Ihandle* prev_child = IupGetChild(ih, nptr->prev_page_number);[m +[31m- IupSetAttribute(child, "VISIBLE", "YES");[m +[31m- IupSetAttribute(prev_child, "VISIBLE", "NO");[m +[32m+[m[32m Widget child_manager = (Widget)iupAttribGet(child, "_IUPTAB_CONTAINER");[m +[32m+[m[32m Widget prev_child_manager = (Widget)iupAttribGet(prev_child, "_IUPTAB_CONTAINER");[m +[32m+[m[32m XtMapWidget(child_manager);[m +[32m+[m[32m if (prev_child_manager) XtUnmapWidget(prev_child_manager);[m + [m + cb = (IFnnn)IupGetCallback(ih, "TABCHANGE_CB");[m + if (cb)[m +[36m@@ -397,12 +401,12 @@[m [mstatic void motTabsChildAddedMethod(Ihandle* ih, Ihandle* child)[m + [m + /* Create tabs */[m + /* Label */[m +[31m- iupmotSetArg(args, num_args, XmNlabelType, tabtitle? XmSTRING: XmPIXMAP);[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelType, tabtitle? XmSTRING: XmPIXMAP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m + /* Notebook Constraint */[m +[31m- iupmotSetArg(args, num_args, XmNnotebookChildType, XmMAJOR_TAB);[m +[31m- iupmotSetArg(args, num_args, XmNpageNumber, pos);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnotebookChildType, XmMAJOR_TAB);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNpageNumber, pos);[m + tab_button = XtCreateManagedWidget("tab_button", xmPushButtonWidgetClass, ih->handle, args, num_args);[m + [m + /* Disable Drag Source */[m +[36m@@ -450,10 +454,8 @@[m [mstatic void motTabsChildAddedMethod(Ihandle* ih, Ihandle* child)[m + iupAttribSetStr(child, "_IUPMOT_TABBUTTON", (char*)tab_button);[m + iupAttribSetInt(child, "_IUPMOT_TABNUMBER", pos);[m + [m +[31m- if (pos == iupdrvTabsGetCurrentTab(ih))[m +[31m- IupSetAttribute(child, "VISIBLE", "YES");[m +[31m- else[m +[31m- IupSetAttribute(child, "VISIBLE", "NO");[m +[32m+[m[32m if (pos != iupdrvTabsGetCurrentTab(ih))[m +[32m+[m[32m XtUnmapWidget(child_manager);[m + }[m + }[m + [m +[36m@@ -464,20 +466,11 @@[m [mstatic void motTabsChildRemovedMethod(Ihandle* ih, Ihandle* child)[m + Widget child_manager = (Widget)iupAttribGet(child, "_IUPTAB_CONTAINER");[m + if (child_manager)[m + {[m +[31m- int cur_pos, pos;[m +[32m+[m[32m int pos;[m + Widget tab_button = (Widget)iupAttribGet(child, "_IUPMOT_TABBUTTON");[m + [m +[31m- cur_pos = iupdrvTabsGetCurrentTab(ih);[m + pos = iupAttribGetInt(child, "_IUPMOT_TABNUMBER"); /* did not work when using XtVaGetValues(child_manager, XmNpageNumber) */[m +[31m- if (cur_pos == pos)[m +[31m- {[m +[31m- if (cur_pos == 0)[m +[31m- cur_pos = 1;[m +[31m- else[m +[31m- cur_pos--;[m +[31m-[m +[31m- iupdrvTabsSetCurrentTab(ih, cur_pos);[m +[31m- }[m +[32m+[m[32m iupTabsTestRemoveTab(ih, pos);[m + [m + XtDestroyWidget(tab_button);[m + XtDestroyWidget(child_manager);[m +[36m@@ -501,22 +494,22 @@[m [mstatic int motTabsMapMethod(Ihandle* ih)[m + return IUP_ERROR;[m + [m + /* Core */[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + /* Manager */[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 0);[m + /* Notebook */[m +[31m- iupmotSetArg(args, num_args, XmNbindingType, XmNONE);[m +[31m- iupmotSetArg(args, num_args, XmNbindingWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNfirstPageNumber, 0); /* IupTabs index always starts with zero */[m +[31m- iupmotSetArg(args, num_args, XmNbackPageSize, 0);[m +[31m- iupmotSetArg(args, num_args, XmNbackPageNumber, 1);[m +[31m- iupmotSetArg(args, num_args, XmNframeShadowThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNbindingType, XmNONE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNbindingWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNfirstPageNumber, 0); /* IupTabs index always starts with zero */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNbackPageSize, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNbackPageNumber, 1);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNframeShadowThickness, 2);[m + [m + ih->handle = XtCreateManagedWidget([m + iupDialogGetChildIdStr(ih), /* child identifier */[m +[36m@@ -589,5 +582,5 @@[m [mvoid iupdrvTabsInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "TABORIENTATION", iupTabsGetTabOrientationAttrib, NULL, IUPAF_SAMEASSYSTEM, "HORIZONTAL", IUPAF_READONLY|IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT); /* can not be set, always HORIZONTAL in Motif */[m + iupClassRegisterAttributeId(ic, "TABTITLE", NULL, motTabsSetTabTitleAttrib, IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TABIMAGE", NULL, motTabsSetTabImageAttrib, IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttribute(ic, "PADDING", iupTabsGetPaddingAttrib, motTabsSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "PADDING", iupTabsGetPaddingAttrib, motTabsSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + }[m +[1mdiff --git a/iup/src/mot/iupmot_text.c b/iup/src/mot/iupmot_text.c[m +[1mindex 4a8f936..d9d2c74 100755[m +[1m--- a/iup/src/mot/iupmot_text.c[m +[1m+++ b/iup/src/mot/iupmot_text.c[m +[36m@@ -142,8 +142,10 @@[m [mstatic int motTextSetPaddingAttrib(Ihandle* ih, const char* value)[m + {[m + XtVaSetValues(ih->handle, XmNmarginHeight, ih->data->vert_padding,[m + XmNmarginWidth, ih->data->horiz_padding, NULL);[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int motTextSetReadOnlyAttrib(Ihandle* ih, const char* value)[m +[36m@@ -164,7 +166,7 @@[m [mstatic char* motTextGetReadOnlyAttrib(Ihandle* ih)[m + [m + static int motTextSetInsertAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + if (!value)[m + return 0;[m +[36m@@ -207,12 +209,12 @@[m [mstatic char* motTextGetSelectedTextAttrib(Ihandle* ih)[m + static int motTextSetAppendAttrib(Ihandle* ih, const char* value)[m + {[m + XmTextPosition pos;[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + pos = XmTextGetLastPosition(ih->handle);[m + /* disable callbacks */[m + iupAttribSetStr(ih, "_IUPMOT_DISABLE_TEXT_CB", "1");[m +[31m- if (ih->data->is_multiline && ih->data->append_newline)[m +[32m+[m[32m if (ih->data->is_multiline && ih->data->append_newline && pos!=0)[m + XmTextInsert(ih->handle, pos, "\n");[m + if (value)[m + XmTextInsert(ih->handle, pos+1, (char*)value);[m +[36m@@ -482,8 +484,12 @@[m [mstatic int motTextSetNCAttrib(Ihandle* ih, const char* value)[m + if (!iupStrToInt(value, &ih->data->nc))[m + ih->data->nc = INT_MAX;[m + if (ih->handle)[m +[32m+[m[32m {[m + XtVaSetValues(ih->handle, XmNmaxLength, ih->data->nc, NULL);[m +[31m- return 0;[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int motTextSetClipboardAttrib(Ihandle *ih, const char *value)[m +[36m@@ -911,6 +917,10 @@[m [mstatic void motTextLayoutUpdateMethod(Ihandle* ih)[m + Widget spinbox = (Widget)iupAttribGet(ih, "_IUP_EXTRAPARENT");[m + if (spinbox && XmIsSpinBox(spinbox))[m + {[m +[32m+[m[32m /* avoid abort in X */[m +[32m+[m[32m if (ih->currentwidth == 0) ih->currentwidth = 1;[m +[32m+[m[32m if (ih->currentheight == 0) ih->currentheight = 1;[m +[32m+[m + XtVaSetValues(ih->handle,[m + XmNwidth, (XtArgVal)ih->currentwidth-ih->currentheight/2,[m + XmNheight, (XtArgVal)ih->currentheight,[m +[36m@@ -952,13 +962,13 @@[m [mstatic int motTextMapMethod(Ihandle* ih)[m + /* Create the scrolled window */[m + /******************************/[m + [m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNscrollingPolicy, XmAPPLICATION_DEFINED);[m +[31m- iupmotSetArg(args, num_args, XmNvisualPolicy, XmVARIABLE);[m +[31m- iupmotSetArg(args, num_args, XmNscrollBarDisplayPolicy, XmSTATIC); /* can NOT be XmAS_NEEDED because XmAPPLICATION_DEFINED */[m +[31m- iupmotSetArg(args, num_args, XmNspacing, 0); /* no space between scrollbars and text */[m +[31m- iupmotSetArg(args, num_args, XmNborderWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollingPolicy, XmAPPLICATION_DEFINED);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNvisualPolicy, XmVARIABLE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollBarDisplayPolicy, XmSTATIC); /* can NOT be XmAS_NEEDED because XmAPPLICATION_DEFINED */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNspacing, 0); /* no space between scrollbars and text */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNborderWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m + [m + sb_win = XtCreateManagedWidget([m + child_id, /* child identifier */[m +[36m@@ -973,9 +983,9 @@[m [mstatic int motTextMapMethod(Ihandle* ih)[m + child_id = "text";[m + [m + num_args = 0;[m +[31m- iupmotSetArg(args, num_args, XmNeditMode, XmMULTI_LINE_EDIT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNeditMode, XmMULTI_LINE_EDIT);[m + if (wordwrap)[m +[31m- iupmotSetArg(args, num_args, XmNwordWrap, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwordWrap, True);[m + }[m + else[m + {[m +[36m@@ -986,18 +996,18 @@[m [mstatic int motTextMapMethod(Ihandle* ih)[m + Widget spinbox;[m + [m + num_args = 0;[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNspacing, 0); /* no space between spin and text */[m +[31m- iupmotSetArg(args, num_args, XmNborderWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNarrowSize, 8);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNspacing, 0); /* no space between spin and text */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNborderWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNarrowSize, 8);[m + [m + if (iupStrEqualNoCase(iupAttribGetStr(ih, "SPINALIGN"), "LEFT"))[m +[31m- iupmotSetArg(args, num_args, XmNarrowLayout, XmARROWS_BEGINNING);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNarrowLayout, XmARROWS_BEGINNING);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNarrowLayout, XmARROWS_END);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNarrowLayout, XmARROWS_END);[m + [m + spinbox = XtCreateManagedWidget([m + child_id, /* child identifier */[m +[36m@@ -1019,61 +1029,61 @@[m [mstatic int motTextMapMethod(Ihandle* ih)[m + }[m + [m + num_args = 0;[m +[31m- iupmotSetArg(args, num_args, XmNeditMode, XmSINGLE_LINE_EDIT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNeditMode, XmSINGLE_LINE_EDIT);[m + [m + if (spin)[m + {[m + /* Spin Constraints */[m +[31m- iupmotSetArg(args, num_args, XmNspinBoxChildType, XmNUMERIC);[m +[31m- iupmotSetArg(args, num_args, XmNminimumValue, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmaximumValue, 100);[m +[31m- iupmotSetArg(args, num_args, XmNposition, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNspinBoxChildType, XmNUMERIC);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNminimumValue, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmaximumValue, 100);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNposition, 0);[m + [m + if (iupAttribGetBoolean(ih, "SPINWRAP"))[m +[31m- iupmotSetArg(args, num_args, XmNwrap, TRUE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwrap, TRUE);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNwrap, FALSE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwrap, FALSE);[m + }[m + else[m + {[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m + }[m + }[m + [m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + [m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m + [m + if (iupAttribGetBoolean(ih, "CANFOCUS"))[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m + [m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 2);[m +[31m- iupmotSetArg(args, num_args, XmNverifyBell, False);[m +[31m- iupmotSetArg(args, num_args, XmNspacing, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNverifyBell, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNspacing, 0);[m + [m + if (iupAttribGetBoolean(ih, "BORDER"))[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 2);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m + [m + if (ih->data->is_multiline)[m + {[m + if (ih->data->sb & IUP_SB_HORIZ)[m +[31m- iupmotSetArg(args, num_args, XmNscrollHorizontal, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollHorizontal, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNscrollHorizontal, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollHorizontal, False);[m + [m + if (ih->data->sb & IUP_SB_VERT)[m +[31m- iupmotSetArg(args, num_args, XmNscrollVertical, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollVertical, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNscrollVertical, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollVertical, False);[m + }[m + [m + ih->handle = XtCreateManagedWidget([m +[1mdiff --git a/iup/src/mot/iupmot_toggle.c b/iup/src/mot/iupmot_toggle.c[m +[1mindex b18f24d..1fda258 100755[m +[1m--- a/iup/src/mot/iupmot_toggle.c[m +[1m+++ b/iup/src/mot/iupmot_toggle.c[m +[36m@@ -236,8 +236,10 @@[m [mstatic int motToggleSetPaddingAttrib(Ihandle* ih, const char* value)[m + {[m + XtVaSetValues(ih->handle, XmNmarginHeight, ih->data->vert_padding,[m + XmNmarginWidth, ih->data->horiz_padding, NULL);[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static char* motToggleGetSelectColorAttrib(Ihandle* ih)[m +[36m@@ -336,40 +338,40 @@[m [mstatic int motToggleMapMethod(Ihandle* ih)[m + if (value)[m + {[m + ih->data->type = IUP_TOGGLE_IMAGE;[m +[31m- iupmotSetArg(args, num_args, XmNlabelType, XmPIXMAP); [m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelType, XmPIXMAP);[m[41m [m + }[m + else[m + {[m + ih->data->type = IUP_TOGGLE_TEXT;[m +[31m- iupmotSetArg(args, num_args, XmNlabelType, XmSTRING); [m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelType, XmSTRING);[m[41m [m + }[m + [m + /* Core */[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + /* Primitive */[m + if (iupAttribGetBoolean(ih, "CANFOCUS"))[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 2);[m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP);[m + /* Label */[m +[31m- iupmotSetArg(args, num_args, XmNrecomputeSize, False); /* no automatic resize from text */[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginTop, 0); /* no extra margins */[m +[31m- iupmotSetArg(args, num_args, XmNmarginLeft, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginBottom, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmarginRight, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNrecomputeSize, False); /* no automatic resize from text */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginTop, 0); /* no extra margins */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginLeft, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginBottom, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginRight, 0);[m + [m + if (radio)[m + {[m +[31m- iupmotSetArg(args, num_args, XmNtoggleMode, XmTOGGLE_BOOLEAN);[m +[31m- iupmotSetArg(args, num_args, XmNindicatorType, XmONE_OF_MANY_ROUND);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtoggleMode, XmTOGGLE_BOOLEAN);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorType, XmONE_OF_MANY_ROUND);[m + [m + if (!iupAttribGet(radio, "_IUPMOT_LASTTOGGLE"))[m + {[m +[36m@@ -380,33 +382,33 @@[m [mstatic int motToggleMapMethod(Ihandle* ih)[m + else[m + {[m + if (ih->data->type == IUP_TOGGLE_TEXT && iupAttribGetBoolean(ih, "3STATE"))[m +[31m- iupmotSetArg(args, num_args, XmNtoggleMode, XmTOGGLE_INDETERMINATE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtoggleMode, XmTOGGLE_INDETERMINATE);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtoggleMode, XmTOGGLE_BOOLEAN);[m +[31m- iupmotSetArg(args, num_args, XmNindicatorType, XmN_OF_MANY);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtoggleMode, XmTOGGLE_BOOLEAN);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorType, XmN_OF_MANY);[m + }[m + [m + if (ih->data->type == IUP_TOGGLE_IMAGE)[m + {[m +[31m- iupmotSetArg(args, num_args, XmNindicatorOn, XmINDICATOR_NONE);[m +[31m- iupmotSetArg(args, num_args, XmNalignment, XmALIGNMENT_CENTER);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorOn, XmINDICATOR_NONE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNalignment, XmALIGNMENT_CENTER);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 2);[m + }[m + else[m + {[m +[31m- iupmotSetArg(args, num_args, XmNspacing, 3);[m +[31m- iupmotSetArg(args, num_args, XmNindicatorOn, XmINDICATOR_CHECK_BOX);[m +[31m- iupmotSetArg(args, num_args, XmNalignment, XmALIGNMENT_BEGINNING);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNspacing, 3);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorOn, XmINDICATOR_CHECK_BOX);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNalignment, XmALIGNMENT_BEGINNING);[m + if (radio)[m + {[m +[31m- iupmotSetArg(args, num_args, XmNindicatorSize, 13);[m +[31m- iupmotSetArg(args, num_args, XmNselectColor, iupmotColorGetPixel(0, 0, 0));[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorSize, 13);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNselectColor, iupmotColorGetPixel(0, 0, 0));[m + }[m + else[m +[31m- iupmotSetArg(args, num_args, XmNindicatorSize, 15);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNindicatorSize, 15);[m + [m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[31m- iupmotSetArg(args, num_args, XmNdetailShadowThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNdetailShadowThickness, 2);[m + }[m + [m + ih->handle = XtCreateManagedWidget([m +[1mdiff --git a/iup/src/mot/iupmot_tree.c b/iup/src/mot/iupmot_tree.c[m +[1mindex eb230af..fa5ef09 100755[m +[1m--- a/iup/src/mot/iupmot_tree.c[m +[1m+++ b/iup/src/mot/iupmot_tree.c[m +[36m@@ -46,48 +46,20 @@[m [mtypedef struct _motTreeItemData[m + Pixmap image, image_mask;[m + Pixmap image_expanded, image_expanded_mask;[m + unsigned char kind;[m +[31m- void* userdata;[m + } motTreeItemData;[m + [m + [m + static void motTreeShowEditField(Ihandle* ih, Widget wItem);[m +[31m-static int motTreeGetNodeId(Ihandle* ih, Widget wItem);[m +[32m+[m[32mstatic void motTreeRemoveNode(Ihandle* ih, Widget wItem, int del_data, int call_cb);[m + [m +[31m-typedef int (*motTreeNodeFunc)(Ihandle* ih, Widget wItem, void* userdata);[m +[31m-[m +[31m-static int motTreeForEach(Ihandle* ih, Widget wItem, motTreeNodeFunc func, void* userdata)[m +[31m-{[m +[31m- WidgetList wItemChildList = NULL;[m +[31m- int i, numChild;[m +[31m-[m +[31m- if (!wItem)[m +[31m- wItem = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m-[m +[31m- if (!func(ih, wItem, userdata))[m +[31m- return 0;[m +[31m-[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, wItem, &wItemChildList);[m +[31m- for (i=0; i<numChild; i++)[m +[31m- {[m +[31m- /* Recursively traverse child items */[m +[31m- if (!motTreeForEach(ih, wItemChildList[i], func, userdata))[m +[31m- {[m +[31m- XtFree((char*)wItemChildList);[m +[31m- return 0;[m +[31m- }[m +[31m- }[m +[31m- if (wItemChildList) XtFree((char*)wItemChildList);[m +[31m-[m +[31m- return 1;[m +[31m-}[m + [m + /*****************************************************************************/[m + /* COPYING ITEMS (Branches and its children) */[m + /*****************************************************************************/[m + /* Insert the copied item in a new location. Returns the new item. */[m +[31m-static Widget motTreeCopyItem(Ihandle* ih, Widget wItem, Widget wParent, int pos, int full_copy)[m +[32m+[m[32mstatic Widget motTreeCopyItem(Ihandle* ih, Widget wItem, Widget wParent, int pos, int is_copy)[m + {[m +[31m- Widget wNewItem;[m +[32m+[m[32m Widget wItemNew;[m + XmString title;[m + motTreeItemData *itemData;[m + Pixel fgcolor, bgcolor;[m +[36m@@ -96,13 +68,13 @@[m [mstatic Widget motTreeCopyItem(Ihandle* ih, Widget wItem, Widget wParent, int pos[m + Pixmap image = XmUNSPECIFIED_PIXMAP, mask = XmUNSPECIFIED_PIXMAP;[m + unsigned char state;[m + [m +[31m- iupmotSetArg(args, num_args, XmNentryParent, wParent);[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, ih->data->spacing);[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNviewType, XmSMALL_ICON);[m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNentryParent, wParent);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, ih->data->spacing);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNviewType, XmSMALL_ICON);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m + [m + /* Get values to copy */[m + XtVaGetValues(wItem, XmNlabelString, &title,[m +[36m@@ -113,49 +85,73 @@[m [mstatic Widget motTreeCopyItem(Ihandle* ih, Widget wItem, Widget wParent, int pos[m + XmNoutlineState, &state,[m + NULL);[m + [m +[31m- if (full_copy) /* during a full copy the userdata reference is not copied */[m +[32m+[m[32m if (is_copy) /* during a copy the itemdata reference is not reused */[m + {[m + /* create a new one */[m + motTreeItemData* itemDataNew = malloc(sizeof(motTreeItemData));[m + memcpy(itemDataNew, itemData, sizeof(motTreeItemData));[m +[31m- itemDataNew->userdata = NULL;[m + itemData = itemDataNew;[m + }[m + [m +[31m- iupmotSetArg(args, num_args, XmNlabelString, title);[m +[31m- iupmotSetArg(args, num_args, XmNuserData, itemData);[m +[31m- iupmotSetArg(args, num_args, XmNforeground, fgcolor);[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconPixmap, image);[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconMask, mask);[m +[31m- iupmotSetArg(args, num_args, XmNoutlineState, state);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelString, title);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNuserData, itemData);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNforeground, fgcolor);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsmallIconPixmap, image);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsmallIconMask, mask);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNoutlineState, state);[m + [m +[31m- iupmotSetArg(args, num_args, XmNentryParent, wParent);[m +[31m- iupmotSetArg(args, num_args, XmNpositionIndex, pos);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNentryParent, wParent);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNpositionIndex, pos);[m + [m + XtVaGetValues(ih->handle, XmNbackground, &bgcolor, NULL);[m +[31m- iupmotSetArg(args, num_args, XmNbackground, bgcolor);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNbackground, bgcolor);[m +[32m+[m +[32m+[m[32m /* Add the new node */[m +[32m+[m[32m wItemNew = XtCreateManagedWidget("icon", xmIconGadgetClass, ih->handle, args, num_args);[m +[32m+[m[32m ih->data->node_count++;[m +[32m+[m +[32m+[m[32m XtRealizeWidget(wItemNew);[m +[32m+[m +[32m+[m[32m return wItemNew;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void motTreeChildRebuildCacheRec(Ihandle* ih, Widget wItem, int *id)[m +[32m+[m[32m{[m +[32m+[m[32m WidgetList itemChildList = NULL;[m +[32m+[m[32m int i, numChild;[m + [m +[31m- wNewItem = XtCreateManagedWidget("icon", xmIconGadgetClass, ih->handle, args, num_args);[m +[32m+[m[32m /* Check whether we have child items */[m +[32m+[m[32m numChild = XmContainerGetItemChildren(ih->handle, wItem, &itemChildList);[m +[32m+[m +[32m+[m[32m for (i = 0; i < numChild; i++)[m +[32m+[m[32m {[m +[32m+[m[32m (*id)++;[m +[32m+[m[32m ih->data->node_cache[*id].node_handle = itemChildList[i];[m + [m +[31m- /* Root always expanded */[m +[31m- XtVaSetValues((Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM"), XmNoutlineState, XmEXPANDED, NULL);[m +[32m+[m[32m /* go recursive to children */[m +[32m+[m[32m motTreeChildRebuildCacheRec(ih, itemChildList[i], id);[m +[32m+[m[32m }[m + [m +[31m- XtRealizeWidget(wNewItem);[m +[32m+[m[32m if (itemChildList) XtFree((char*)itemChildList);[m +[32m+[m[32m}[m + [m +[31m- return wNewItem;[m +[32m+[m[32mstatic void motTreeRebuildNodeCache(Ihandle* ih, int id, Widget wItem)[m +[32m+[m[32m{[m +[32m+[m[32m ih->data->node_cache[id].node_handle = wItem;[m +[32m+[m[32m motTreeChildRebuildCacheRec(ih, wItem, &id);[m + }[m + [m +[31m-static void motTreeCopyChildren(Ihandle* ih, Widget wItemSrc, Widget wItemDst, int full_copy)[m +[32m+[m[32mstatic void motTreeCopyChildren(Ihandle* ih, Widget wItemSrc, Widget wItemDst, int is_copy)[m + {[m + WidgetList wItemChildList = NULL;[m + int i = 0;[m + int numChild = XmContainerGetItemChildren(ih->handle, wItemSrc, &wItemChildList);[m + while(i != numChild)[m + {[m +[31m- Widget wNewItem = motTreeCopyItem(ih, wItemChildList[i], wItemDst, i, full_copy); /* Use the same order they where enumerated */[m +[32m+[m[32m Widget wItemNew = motTreeCopyItem(ih, wItemChildList[i], wItemDst, i, is_copy); /* Use the same order they where enumerated */[m + [m + /* Recursively transfer all the items */[m +[31m- motTreeCopyChildren(ih, wItemChildList[i], wNewItem, full_copy); [m +[32m+[m[32m motTreeCopyChildren(ih, wItemChildList[i], wItemNew, is_copy);[m[41m [m + [m + /* Go to next sibling item */[m + i++;[m +[36m@@ -165,12 +161,18 @@[m [mstatic void motTreeCopyChildren(Ihandle* ih, Widget wItemSrc, Widget wItemDst, i[m + }[m + [m + /* Copies all items in a branch to a new location. Returns the new branch node. */[m +[31m-static Widget motTreeCopyNode(Ihandle* ih, Widget wItemSrc, Widget wItemDst, int full_copy)[m +[32m+[m[32mstatic Widget motTreeCopyMoveNode(Ihandle* ih, Widget wItemSrc, Widget wItemDst, int is_copy)[m + {[m +[31m- Widget wNewItem, wParent;[m +[32m+[m[32m Widget wItemNew, wParent;[m + motTreeItemData *itemDataDst;[m + unsigned char stateDst;[m +[31m- int pos;[m +[32m+[m[32m int pos, id_new, count, id_src, id_dst;[m +[32m+[m +[32m+[m[32m int old_count = ih->data->node_count;[m +[32m+[m +[32m+[m[32m id_src = iupTreeFindNodeId(ih, wItemSrc);[m +[32m+[m[32m id_dst = iupTreeFindNodeId(ih, wItemDst);[m +[32m+[m[32m id_new = id_dst+1; /* contains the position for a copy operation */[m + [m + XtVaGetValues(wItemDst, XmNoutlineState, &stateDst, [m + XmNuserData, &itemDataDst, [m +[36m@@ -184,17 +186,46 @@[m [mstatic Widget motTreeCopyNode(Ihandle* ih, Widget wItemSrc, Widget wItemDst, int[m + }[m + else[m + {[m +[32m+[m[32m if (itemDataDst->kind == ITREE_BRANCH)[m +[32m+[m[32m {[m +[32m+[m[32m int child_count = iupdrvTreeTotalChildCount(ih, wItemDst);[m +[32m+[m[32m id_new += child_count;[m +[32m+[m[32m }[m +[32m+[m + /* copy as next brother of item or collapsed branch */[m + XtVaGetValues(wItemDst, XmNentryParent, &wParent, NULL);[m + XtVaGetValues(wItemDst, XmNpositionIndex, &pos, NULL);[m + pos++;[m + }[m + [m +[31m- wNewItem = motTreeCopyItem(ih, wItemSrc, wParent, pos, full_copy);[m +[32m+[m[32m /* move to the same place does nothing */[m +[32m+[m[32m if (!is_copy && id_new == id_src)[m +[32m+[m[32m return NULL;[m +[32m+[m +[32m+[m[32m wItemNew = motTreeCopyItem(ih, wItemSrc, wParent, pos, is_copy);[m +[32m+[m +[32m+[m[32m motTreeCopyChildren(ih, wItemSrc, wItemNew, is_copy);[m +[32m+[m +[32m+[m[32m count = ih->data->node_count - old_count;[m +[32m+[m[32m iupTreeCopyMoveCache(ih, id_src, id_new, count, is_copy);[m + [m +[31m- motTreeCopyChildren(ih, wItemSrc, wNewItem, full_copy);[m +[32m+[m[32m if (!is_copy)[m +[32m+[m[32m {[m +[32m+[m[32m /* Deleting the node (and its children) from the old position */[m +[32m+[m[32m /* do not delete the itemdata, we reuse the references in CopyNode */[m +[32m+[m[32m motTreeRemoveNode(ih, wItemSrc, 0, 0);[m +[32m+[m +[32m+[m[32m /* restore count, because we remove src */[m +[32m+[m[32m ih->data->node_count = old_count;[m +[32m+[m +[32m+[m[32m /* compensate position for a move */[m +[32m+[m[32m if (id_new > id_src)[m +[32m+[m[32m id_new -= count;[m +[32m+[m[32m }[m + [m +[31m- return wNewItem;[m +[32m+[m[32m motTreeRebuildNodeCache(ih, id_new, wItemNew);[m +[32m+[m +[32m+[m[32m return wItemNew;[m + }[m + [m + static void motTreeContainerDeselectAll(Ihandle *ih)[m +[36m@@ -233,229 +264,181 @@[m [mstatic void motTreeContainerSelectAll(Ihandle *ih)[m + XtCallActionProc(ih->handle, "ContainerSelectAll", (XEvent*)&ev, 0, 0);[m + }[m + [m +[31m-static Widget motTreeGetLastVisibleNode(Ihandle* ih, Widget wItem)[m +[32m+[m[32mstatic int motTreeIsNodeVisible(Widget wItem, Widget *wLastItemParent)[m + {[m +[31m- unsigned char itemState;[m +[31m-[m +[31m- XtVaGetValues(wItem, XmNoutlineState, &itemState, NULL);[m +[31m-[m +[31m- if (itemState == XmEXPANDED)[m +[32m+[m[32m unsigned char itemParentState;[m +[32m+[m[32m Widget wItemParent = NULL;[m +[32m+[m[32m XtVaGetValues(wItem, XmNentryParent, &wItemParent, NULL);[m +[32m+[m[32m if (!wItemParent || wItemParent == *wLastItemParent)[m +[32m+[m[32m return 1;[m +[32m+[m[32m while(wItemParent)[m + {[m +[31m- WidgetList wChildrenTree = NULL;[m +[31m- int numChildren = XmContainerGetItemChildren(ih->handle, wItem, &wChildrenTree);[m +[31m- if(numChildren)[m +[31m- wItem = motTreeGetLastVisibleNode(ih, wChildrenTree[numChildren - 1]);[m +[31m- if (wChildrenTree) XtFree((char*)wChildrenTree);[m +[32m+[m[32m XtVaGetValues(wItemParent, XmNoutlineState, &itemParentState, NULL);[m +[32m+[m[32m if (itemParentState != XmEXPANDED)[m +[32m+[m[32m return 0;[m +[32m+[m +[32m+[m[32m XtVaGetValues(wItemParent, XmNentryParent, &wItemParent, NULL);[m + }[m + [m +[31m- return wItem;[m +[32m+[m[32m /* save last parent */[m +[32m+[m[32m XtVaGetValues(wItem, XmNentryParent, &wItemParent, NULL);[m +[32m+[m[32m *wLastItemParent = wItemParent;[m +[32m+[m[32m return 1;[m + }[m + [m +[31m-static Widget motTreeFindVisibleNodeId(Ihandle* ih, WidgetList itemList, int numItems, Widget itemNode)[m +[32m+[m[32mstatic Widget motTreeGetLastVisibleNode(Ihandle* ih)[m + {[m +[31m- Widget itemChild;[m +[31m- WidgetList itemChildList;[m +[31m- int i = 0;[m +[31m- int numChild;[m +[31m- unsigned char itemState;[m +[32m+[m[32m int i;[m +[32m+[m[32m Widget wLastItemParent = NULL;[m + [m +[31m- while(i != numItems)[m +[32m+[m[32m for (i = ih->data->node_count-1; i >= 0; i--)[m + {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control++; /* not the real id since it counts only the visible ones */[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(itemList[i] == itemNode)[m +[31m- return itemList[i];[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- itemChildList = NULL;[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, itemList[i], &itemChildList);[m +[31m- XtVaGetValues(itemList[i], XmNoutlineState, &itemState, NULL);[m +[31m-[m +[31m- /* The itemWidget has child and it is expanded (visible) */[m +[31m- if (numChild && itemState == XmEXPANDED)[m +[31m- {[m +[31m- /* pass the list of children of this item */[m +[31m- itemChild = motTreeFindVisibleNodeId(ih, itemChildList, numChild, itemNode);[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(itemChild)[m +[31m- {[m +[31m- XtFree((char*)itemChildList);[m +[31m- return itemChild;[m +[31m- }[m +[31m- }[m +[31m-[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- /* Go to next sibling item */[m +[31m- i++;[m +[32m+[m[32m if (motTreeIsNodeVisible(ih->data->node_cache[i].node_handle, &wLastItemParent))[m +[32m+[m[32m return ih->data->node_cache[i].node_handle;[m + }[m + [m +[31m- return NULL;[m +[32m+[m[32m return ih->data->node_cache[0].node_handle; /* root is always visible */[m + }[m + [m +[31m-static Widget motTreeFindVisibleNodeFromId(Ihandle* ih, WidgetList itemList, int numItems)[m +[32m+[m[32mstatic Widget motTreeGetNextVisibleNode(Ihandle* ih, Widget wItem, int count)[m + {[m +[31m- Widget itemChild;[m +[31m- WidgetList itemChildList;[m +[31m- int i = 0;[m +[31m- int numChild;[m +[31m- unsigned char itemState;[m +[32m+[m[32m int i, id;[m +[32m+[m[32m Widget wLastItemParent = NULL;[m + [m +[31m- while(i != numItems)[m +[31m- {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control--; /* not the real id since it counts only the visible ones */[m +[32m+[m[32m id = iupTreeFindNodeId(ih, wItem);[m +[32m+[m[32m id += count;[m + [m +[31m- /* StateID founded! */[m +[31m- if(ih->data->id_control < 0)[m +[31m- return itemList[i];[m +[32m+[m[32m for (i = id; i < ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (motTreeIsNodeVisible(ih->data->node_cache[i].node_handle, &wLastItemParent))[m +[32m+[m[32m return ih->data->node_cache[i].node_handle;[m +[32m+[m[32m }[m + [m +[31m- /* Check whether we have child items */[m +[31m- itemChildList = NULL;[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, itemList[i], &itemChildList);[m +[31m- XtVaGetValues(itemList[i], XmNoutlineState, &itemState, NULL);[m +[32m+[m[32m return ih->data->node_cache[0].node_handle; /* root is always visible */[m +[32m+[m[32m}[m + [m +[31m- /* The itemWidget has child and it is expanded (visible) */[m +[31m- if (numChild && itemState == XmEXPANDED)[m +[31m- {[m +[31m- /* pass the list of children of this item */[m +[31m- itemChild = motTreeFindVisibleNodeFromId(ih, itemChildList, numChild);[m +[32m+[m[32mstatic Widget motTreeGetPreviousVisibleNode(Ihandle* ih, Widget wItem, int count)[m +[32m+[m[32m{[m +[32m+[m[32m int i, id;[m +[32m+[m[32m Widget wLastItemParent = NULL;[m + [m +[31m- /* StateID founded! */[m +[31m- if(ih->data->id_control < 0)[m +[31m- {[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- return itemChild;[m +[31m- }[m +[31m- }[m +[32m+[m[32m id = iupTreeFindNodeId(ih, wItem);[m +[32m+[m[32m id -= count;[m + [m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- /* Go to next sibling item */[m +[31m- i++;[m +[32m+[m[32m for (i = id; i >= 0; i--)[m +[32m+[m[32m {[m +[32m+[m[32m if (motTreeIsNodeVisible(ih->data->node_cache[i].node_handle, &wLastItemParent))[m +[32m+[m[32m return ih->data->node_cache[i].node_handle;[m + }[m + [m +[31m- return NULL;[m +[32m+[m[32m return motTreeGetLastVisibleNode(ih);[m + }[m + [m +[31m-static Widget motTreeGetNextVisibleNode(Ihandle* ih, Widget wRoot, Widget wItem)[m +[32m+[m[32mstatic void motTreeChildCountRec(Ihandle* ih, Widget wItem, int *count)[m + {[m +[31m- Widget wNext;[m +[32m+[m[32m WidgetList itemChildList = NULL;[m +[32m+[m[32m int i, numChild;[m + [m +[31m- ih->data->id_control = -1;[m +[31m- motTreeFindVisibleNodeId(ih, &wRoot, 1, wItem);[m +[31m- ih->data->id_control++; /* more 1 visible node */[m +[32m+[m[32m /* Check whether we have child items */[m +[32m+[m[32m numChild = XmContainerGetItemChildren(ih->handle, wItem, &itemChildList);[m + [m +[31m- wNext = motTreeFindVisibleNodeFromId(ih, &wRoot, 1);[m +[32m+[m[32m for (i = 0; i < numChild; i++)[m +[32m+[m[32m {[m +[32m+[m[32m (*count)++;[m + [m +[31m- if (ih->data->id_control >= 0)[m +[31m- wNext = motTreeGetLastVisibleNode(ih, wRoot);[m +[32m+[m[32m /* go recursive to children */[m +[32m+[m[32m motTreeChildCountRec(ih, itemChildList[i], count);[m +[32m+[m[32m }[m + [m +[31m- return wNext;[m +[32m+[m[32m if (itemChildList) XtFree((char*)itemChildList);[m + }[m + [m +[31m-static Widget motTreeGetPreviousVisibleNode(Ihandle* ih, Widget wRoot, Widget wItem)[m +[32m+[m[32mint iupdrvTreeTotalChildCount(Ihandle* ih, Widget wItem)[m + {[m +[31m- ih->data->id_control = -1;[m +[31m- motTreeFindVisibleNodeId(ih, &wRoot, 1, wItem);[m +[31m- ih->data->id_control--; /* less 1 visible node */[m +[31m-[m +[31m- if (ih->data->id_control < 0)[m +[31m- ih->data->id_control = 0; /* Begin of tree = Root id */[m +[31m-[m +[31m- return motTreeFindVisibleNodeFromId(ih, &wRoot, 1);[m +[32m+[m[32m int count = 0;[m +[32m+[m[32m motTreeChildCountRec(ih, wItem, &count);[m +[32m+[m[32m return count;[m + }[m + [m +[31m-static void motTreeUpdateBgColor(Ihandle* ih, WidgetList itemList, int numItems, Pixel bgcolor)[m +[32m+[m[32mstatic void motTreeUpdateBgColor(Ihandle* ih, Pixel bgcolor)[m + {[m +[31m- WidgetList itemChildList;[m +[31m- int i = 0;[m +[31m- int numChild;[m +[31m-[m +[31m- while(i != numItems)[m +[32m+[m[32m int i;[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m + {[m +[31m- XtVaSetValues(itemList[i], XmNbackground, bgcolor, NULL);[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- itemChildList = NULL;[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, itemList[i], &itemChildList);[m +[31m- if(numChild)[m +[31m- motTreeUpdateBgColor(ih, itemChildList, numChild, bgcolor);[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m-[m +[31m- /* Go to next sibling item */[m +[31m- i++;[m +[32m+[m[32m XtVaSetValues(ih->data->node_cache[i].node_handle, XmNbackground, bgcolor, NULL);[m + }[m + }[m + [m +[31m-static void motTreeUpdateImages(Ihandle* ih, WidgetList itemList, int numItems, int mode)[m +[32m+[m[32mstatic void motTreeUpdateImages(Ihandle* ih, int mode)[m + {[m +[31m- motTreeItemData *itemData;[m +[31m- int i = 0;[m +[31m-[m +[32m+[m[32m int i;[m + /* called when one of the default images is changed */[m +[31m-[m +[31m- while(i != numItems)[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m + {[m +[31m- /* Get node attributes */[m +[31m- XtVaGetValues(itemList[i], XmNuserData, &itemData, NULL);[m +[31m- [m +[32m+[m[32m motTreeItemData *itemData;[m +[32m+[m[32m Widget wItem = ih->data->node_cache[i].node_handle;[m +[32m+[m +[32m+[m[32m XtVaGetValues(wItem, XmNuserData, &itemData, NULL);[m +[32m+[m + if (itemData->kind == ITREE_BRANCH)[m + {[m + unsigned char itemState;[m +[31m- XtVaGetValues(itemList[i], XmNoutlineState, &itemState, NULL);[m +[32m+[m[32m XtVaGetValues(wItem, XmNoutlineState, &itemState, NULL);[m + [m + if (itemState == XmEXPANDED)[m + {[m + if (mode == ITREE_UPDATEIMAGE_EXPANDED)[m + {[m +[31m- XtVaSetValues(itemList[i], XmNsmallIconPixmap, (itemData->image_expanded!=XmUNSPECIFIED_PIXMAP)? itemData->image_expanded: (Pixmap)ih->data->def_image_expanded, NULL);[m +[31m- XtVaSetValues(itemList[i], XmNsmallIconMask, (itemData->image_expanded_mask!=XmUNSPECIFIED_PIXMAP)? itemData->image_expanded_mask: (Pixmap)ih->data->def_image_expanded_mask, NULL);[m +[32m+[m[32m XtVaSetValues(wItem, XmNsmallIconPixmap, (itemData->image_expanded!=XmUNSPECIFIED_PIXMAP)? itemData->image_expanded: (Pixmap)ih->data->def_image_expanded, NULL);[m +[32m+[m[32m XtVaSetValues(wItem, XmNsmallIconMask, (itemData->image_expanded_mask!=XmUNSPECIFIED_PIXMAP)? itemData->image_expanded_mask: (Pixmap)ih->data->def_image_expanded_mask, NULL);[m + }[m + }[m + else [m + {[m + if (mode == ITREE_UPDATEIMAGE_COLLAPSED)[m + {[m +[31m- XtVaSetValues(itemList[i], XmNsmallIconPixmap, (itemData->image!=XmUNSPECIFIED_PIXMAP)? itemData->image: (Pixmap)ih->data->def_image_collapsed, NULL);[m +[31m- XtVaSetValues(itemList[i], XmNsmallIconMask, (itemData->image_mask!=XmUNSPECIFIED_PIXMAP)? itemData->image_mask: (Pixmap)ih->data->def_image_collapsed_mask, NULL);[m +[32m+[m[32m XtVaSetValues(wItem, XmNsmallIconPixmap, (itemData->image!=XmUNSPECIFIED_PIXMAP)? itemData->image: (Pixmap)ih->data->def_image_collapsed, NULL);[m +[32m+[m[32m XtVaSetValues(wItem, XmNsmallIconMask, (itemData->image_mask!=XmUNSPECIFIED_PIXMAP)? itemData->image_mask: (Pixmap)ih->data->def_image_collapsed_mask, NULL);[m + }[m + }[m +[31m-[m +[31m- /* Recursively traverse child items */[m +[31m- {[m +[31m- WidgetList itemChildList;[m +[31m- int numChild;[m +[31m- itemChildList = NULL;[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, itemList[i], &itemChildList);[m +[31m- motTreeUpdateImages(ih, itemChildList, numChild, mode);[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- }[m + }[m + else [m + {[m + if (mode == ITREE_UPDATEIMAGE_LEAF)[m + {[m +[31m- XtVaSetValues(itemList[i], XmNsmallIconPixmap, (itemData->image!=XmUNSPECIFIED_PIXMAP)? itemData->image: (Pixmap)ih->data->def_image_leaf, NULL);[m +[31m- XtVaSetValues(itemList[i], XmNsmallIconMask, (itemData->image_mask!=XmUNSPECIFIED_PIXMAP)? itemData->image_mask: (Pixmap)ih->data->def_image_leaf_mask, NULL);[m +[32m+[m[32m XtVaSetValues(wItem, XmNsmallIconPixmap, (itemData->image!=XmUNSPECIFIED_PIXMAP)? itemData->image: (Pixmap)ih->data->def_image_leaf, NULL);[m +[32m+[m[32m XtVaSetValues(wItem, XmNsmallIconMask, (itemData->image_mask!=XmUNSPECIFIED_PIXMAP)? itemData->image_mask: (Pixmap)ih->data->def_image_leaf_mask, NULL);[m + }[m + }[m +[31m-[m +[31m- /* Go to next sibling node */[m +[31m- i++;[m + }[m + }[m + [m +[31m-static int motTreeSelectFunc(Ihandle* ih, Widget wItem, int *select)[m +[32m+[m[32mstatic int motTreeIsNodeSelected(Widget wItem)[m +[32m+[m[32m{[m +[32m+[m[32m unsigned char isSelected;[m +[32m+[m[32m XtVaGetValues(wItem, XmNvisualEmphasis, &isSelected, NULL);[m +[32m+[m[32m if(isSelected == XmSELECTED)[m +[32m+[m[32m return 1;[m +[32m+[m[32m else[m +[32m+[m[32m return 0;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void motTreeSelectNode(Widget wItem, int select)[m +[32m+[m[32m{[m +[32m+[m[32m if (select == -1)[m +[32m+[m[32m select = !motTreeIsNodeSelected(wItem); /* toggle */[m +[32m+[m +[32m+[m[32m if (select)[m +[32m+[m[32m XtVaSetValues(wItem, XmNvisualEmphasis, XmSELECTED, NULL);[m +[32m+[m[32m else[m +[32m+[m[32m XtVaSetValues(wItem, XmNvisualEmphasis, XmNOT_SELECTED, NULL);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic int motTreeSelectFunc(Ihandle* ih, Widget wItem, int id, int *select)[m + {[m + int do_select = *select;[m + if (do_select == -1)[m +[31m- {[m +[31m- unsigned char isSelected;[m +[31m- XtVaGetValues(wItem, XmNvisualEmphasis, &isSelected, NULL);[m +[31m- do_select = (isSelected == XmSELECTED)? 0: 1; /* toggle */[m +[31m- }[m +[32m+[m[32m do_select = !motTreeIsNodeSelected(wItem); /* toggle */[m + [m + if (do_select)[m + XtVaSetValues(wItem, XmNvisualEmphasis, XmSELECTED, NULL);[m +[36m@@ -463,272 +446,111 @@[m [mstatic int motTreeSelectFunc(Ihandle* ih, Widget wItem, int *select)[m + XtVaSetValues(wItem, XmNvisualEmphasis, XmNOT_SELECTED, NULL);[m + [m + (void)ih;[m +[32m+[m[32m (void)id;[m + return 1;[m + }[m + [m + static void motTreeInvertAllNodeMarking(Ihandle* ih)[m + {[m + int select = -1;[m +[31m- motTreeForEach(ih, NULL, (motTreeNodeFunc)motTreeSelectFunc, &select);[m +[32m+[m[32m iupTreeForEach(ih, (iupTreeNodeFunc)motTreeSelectFunc, &select);[m + }[m + [m +[31m-typedef struct _motTreeRange{[m +[31m- Widget wItem1, wItem2;[m +[31m- char inside, clear;[m +[31m-}motTreeRange;[m +[31m-[m +[31m-static int motTreeSelectRangeFunc(Ihandle* ih, Widget wItem, motTreeRange* range)[m +[32m+[m[32mstatic void motTreeSelectRange(Ihandle* ih, Widget wItem1, Widget wItem2, int clear)[m + {[m +[31m- int end_range = 0;[m +[31m-[m +[31m- if (range->inside == 0) /* detect the range start */[m +[31m- {[m +[31m- if (range->wItem1 == wItem) range->inside=1;[m +[31m- else if (range->wItem2 == wItem) range->inside=1;[m +[31m- }[m +[31m- else if (range->inside == 1) /* detect the range end */[m +[32m+[m[32m int i;[m +[32m+[m[32m int id1 = iupTreeFindNodeId(ih, wItem1);[m +[32m+[m[32m int id2 = iupTreeFindNodeId(ih, wItem2);[m +[32m+[m[32m if (id1 > id2)[m + {[m +[31m- if (range->wItem1 == wItem) end_range=1;[m +[31m- else if (range->wItem2 == wItem) end_range=1;[m +[32m+[m[32m int tmp = id1;[m +[32m+[m[32m id1 = id2;[m +[32m+[m[32m id2 = tmp;[m + }[m + [m +[31m- if (range->inside == 1) /* if inside, select */[m +[31m- XtVaSetValues(wItem, XmNvisualEmphasis, XmSELECTED, NULL);[m +[31m- else if (range->clear) /* if outside and clear, unselect */[m +[31m- XtVaSetValues(wItem, XmNvisualEmphasis, XmNOT_SELECTED, NULL);[m +[31m-[m +[31m- if (end_range || (range->inside && range->wItem1==range->wItem2))[m +[31m- range->inside=-1; /* update after selecting the node */[m +[31m-[m +[31m- (void)ih;[m +[31m- return 1;[m +[31m-}[m +[31m-[m +[31m-static void motTreeSelectRange(Ihandle* ih, Widget wItem1, Widget wItem2, int clear)[m +[31m-{[m +[31m- motTreeRange range;[m +[31m- range.wItem1 = wItem1;[m +[31m- range.wItem2 = wItem2;[m +[31m- range.inside = 0;[m +[31m- range.clear = (char)clear;[m +[31m- motTreeForEach(ih, NULL, (motTreeNodeFunc)motTreeSelectRangeFunc, &range);[m +[31m-}[m +[31m-[m +[31m-void motTreeExpandCollapseAllNodes(Ihandle* ih, WidgetList itemList, int numItems, unsigned char itemState)[m +[31m-{[m +[31m- WidgetList itemChildList;[m +[31m- int numChild;[m +[31m- int i = 0;[m +[31m-[m +[31m- while(i != numItems)[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m + {[m +[31m- /* Check whether we have child items */[m +[31m- itemChildList = NULL;[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, itemList[i], &itemChildList);[m +[31m-[m +[31m- if(numChild)[m +[32m+[m[32m if (i < id1 || i > id2)[m + {[m +[31m- XtVaSetValues(itemList[i], XmNoutlineState, itemState, NULL);[m +[31m- motTreeExpandCollapseAllNodes(ih, itemChildList, numChild, itemState);[m +[32m+[m[32m if (clear)[m +[32m+[m[32m XtVaSetValues(ih->data->node_cache[i].node_handle, XmNvisualEmphasis, XmNOT_SELECTED, NULL);[m + }[m +[31m-[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- /* Go to next sibling item */[m +[31m- i++;[m +[32m+[m[32m else[m +[32m+[m[32m XtVaSetValues(ih->data->node_cache[i].node_handle, XmNvisualEmphasis, XmSELECTED, NULL);[m + }[m + }[m + [m +[31m-static void motTreeDestroyItemData(Ihandle* ih, Widget wItem)[m +[32m+[m[32mvoid motTreeExpandCollapseAllNodes(Ihandle* ih, unsigned char itemState)[m + {[m +[31m- motTreeItemData *itemData = NULL;[m +[31m- XtVaGetValues(wItem, XmNuserData, &itemData, NULL);[m +[31m- if (itemData)[m +[32m+[m[32m int i;[m +[32m+[m[32m /* called when one of the default images is changed */[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m + {[m +[31m- IFnis cb = (IFnis)IupGetCallback(ih, "NODEREMOVED_CB");[m +[31m- if (cb) cb(ih, motTreeGetNodeId(ih, wItem), (char*)itemData->userdata);[m +[31m- free(itemData);[m +[31m- XtVaSetValues(wItem, XmNuserData, NULL, NULL);[m +[31m- }[m +[31m-}[m +[31m-[m +[31m-static void motTreeRemoveChildren(Ihandle* ih, WidgetList itemList, int numItems, int del_userdata)[m +[31m-{[m +[31m- WidgetList itemChildList;[m +[31m- int numChild;[m +[31m- int i = 0;[m +[32m+[m[32m motTreeItemData *itemData;[m +[32m+[m[32m Widget wItem = ih->data->node_cache[i].node_handle;[m + [m +[31m- while(i != numItems)[m +[31m- { [m +[32m+[m[32m XtVaGetValues(wItem, XmNuserData, &itemData, NULL);[m +[32m+[m[41m [m + /* Check whether we have child items */[m +[31m- itemChildList = NULL;[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, itemList[i], &itemChildList);[m +[31m- if (numChild)[m +[31m- motTreeRemoveChildren(ih, itemChildList, numChild, del_userdata);[m +[31m-[m +[31m- if (del_userdata)[m +[31m- motTreeDestroyItemData(ih, itemList[i]);[m +[31m-[m +[31m- XtDestroyWidget(itemList[i]);[m +[31m-[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- /* Go to next sibling item */[m +[31m- i++;[m +[32m+[m[32m if (itemData->kind == ITREE_BRANCH)[m +[32m+[m[32m XtVaSetValues(wItem, XmNoutlineState, itemState, NULL);[m + }[m + }[m + [m +[31m-static void motTreeRemoveNode(Ihandle* ih, Widget wItem, int del_userdata)[m +[32m+[m[32mstatic void motTreeDestroyItemData(Ihandle* ih, Widget wItem, int del_data, IFns cb, int id)[m + {[m +[31m- WidgetList wChildList = NULL;[m +[31m- int numChild = XmContainerGetItemChildren(ih->handle, wItem, &wChildList);[m +[31m- if (numChild)[m +[31m- motTreeRemoveChildren(ih, wChildList, numChild, del_userdata);[m +[31m- if (del_userdata)[m +[31m- motTreeDestroyItemData(ih, wItem);[m +[31m- XtDestroyWidget(wItem);[m +[31m- if (wChildList) XtFree((char*)wChildList);[m +[31m-}[m +[31m-[m +[31m-static Widget motTreeFindNodeID(Ihandle* ih, WidgetList itemList, int numItems, Widget itemNode)[m +[31m-{[m +[31m- Widget itemChild;[m +[31m- WidgetList itemChildList;[m +[31m- int i = 0;[m +[31m- int numChild;[m +[31m-[m +[31m- while(i != numItems)[m +[32m+[m[32m motTreeItemData *itemData = NULL;[m +[32m+[m[32m XtVaGetValues(wItem, XmNuserData, &itemData, NULL);[m +[32m+[m[32m if (itemData)[m + {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control++;[m +[32m+[m[32m if (cb)[m[41m [m +[32m+[m[32m cb(ih, (char*)ih->data->node_cache[id].userdata);[m + [m +[31m- /* StateID founded! */[m +[31m- if(itemList[i] == itemNode)[m +[31m- return itemList[i];[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- itemChildList = NULL;[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, itemList[i], &itemChildList);[m +[31m- if(numChild)[m +[32m+[m[32m if (del_data)[m + {[m +[31m- /* pass the list of children of this item */[m +[31m- itemChild = motTreeFindNodeID(ih, itemChildList, numChild, itemNode);[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(itemChild)[m +[31m- {[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- return itemChild;[m +[31m- }[m +[32m+[m[32m free(itemData);[m +[32m+[m[32m XtVaSetValues(wItem, XmNuserData, NULL, NULL);[m + }[m +[31m-[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- /* Go to next sibling item */[m +[31m- i++;[m + }[m +[31m-[m +[31m- return NULL;[m + }[m + [m +[31m-static Widget motTreeFindNodeFromID(Ihandle* ih, WidgetList itemList, int numItems)[m +[32m+[m[32mstatic void motTreeRemoveNodeRec(Ihandle* ih, Widget wItem, int del_data, IFns cb, int *id)[m + {[m +[31m- Widget itemChild;[m +[31m- WidgetList itemChildList;[m +[31m- int i = 0;[m +[31m- int numChild;[m +[32m+[m[32m WidgetList itemChildList = NULL;[m +[32m+[m[32m int i, numChild;[m +[32m+[m[32m int old_id = *id;[m + [m +[31m- while(i != numItems)[m +[32m+[m[32m /* Check whether we have child items */[m +[32m+[m[32m /* remove from children first */[m +[32m+[m[32m numChild = XmContainerGetItemChildren(ih->handle, wItem, &itemChildList);[m +[32m+[m[32m for (i = 0; i < numChild; i++)[m + {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control--;[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(ih->data->id_control < 0)[m +[31m- return itemList[i];[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- itemChildList = NULL;[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, itemList[i], &itemChildList);[m +[31m- if(numChild)[m +[31m- {[m +[31m- /* pass the list of children of this item */[m +[31m- itemChild = motTreeFindNodeFromID(ih, itemChildList, numChild);[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(ih->data->id_control < 0)[m +[31m- {[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- return itemChild;[m +[31m- }[m +[31m- }[m +[31m-[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- /* Go to next sibling item */[m +[31m- i++;[m +[32m+[m[32m /* go recursive to children */[m +[32m+[m[32m motTreeRemoveNodeRec(ih, itemChildList[i], del_data, cb, id);[m + }[m +[32m+[m[32m if (itemChildList) XtFree((char*)itemChildList);[m + [m +[31m- return NULL;[m +[31m-}[m +[32m+[m[32m /* actually do it for the node */[m +[32m+[m[32m ih->data->node_count--;[m +[32m+[m[32m (*id)++;[m + [m +[31m-static int motTreeGetNodeId(Ihandle* ih, Widget wItem)[m +[31m-{[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m- ih->data->id_control = -1;[m +[31m- if (motTreeFindNodeID(ih, &wRoot, 1, wItem))[m +[31m- return ih->data->id_control;[m +[31m- else[m +[31m- return -1;[m +[32m+[m[32m if (del_data || cb)[m +[32m+[m[32m motTreeDestroyItemData(ih, wItem, del_data, cb, old_id);[m +[32m+[m +[32m+[m[32m XtDestroyWidget(wItem); /* must manually destroy each node, this is NOT recursive */[m + }[m + [m +[31m-static Widget motTreeFindUserDataID(Ihandle* ih, WidgetList itemList, int numItems, void* userdata)[m +[32m+[m[32mstatic void motTreeRemoveNode(Ihandle* ih, Widget wItem, int del_data, int call_cb)[m + {[m +[31m- Widget itemChild;[m +[31m- WidgetList itemChildList;[m +[31m- motTreeItemData *itemData;[m +[31m- int i = 0;[m +[31m- int numChild;[m +[31m-[m +[31m- while(i != numItems)[m +[31m- {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control++;[m +[31m-[m +[31m- XtVaGetValues(itemList[i], XmNuserData, &itemData, NULL);[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(itemData->userdata == userdata)[m +[31m- return itemList[i];[m +[32m+[m[32m IFns cb = call_cb? (IFns)IupGetCallback(ih, "NODEREMOVED_CB"): NULL;[m +[32m+[m[32m int old_count = ih->data->node_count;[m +[32m+[m[32m int id = iupTreeFindNodeId(ih, wItem);[m +[32m+[m[32m int old_id = id;[m + [m +[31m- /* Check whether we have child items */[m +[31m- itemChildList = NULL;[m +[31m- numChild = XmContainerGetItemChildren(ih->handle, itemList[i], &itemChildList);[m +[31m- if(numChild)[m +[31m- {[m +[31m- /* pass the list of children of this item */[m +[31m- itemChild = motTreeFindUserDataID(ih, itemChildList, numChild, userdata);[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if (itemChild)[m +[31m- {[m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- return itemChild;[m +[31m- }[m +[31m- }[m +[32m+[m[32m motTreeRemoveNodeRec(ih, wItem, del_data, cb, &id);[m + [m +[31m- if (itemChildList) XtFree((char*)itemChildList);[m +[31m- /* Go to next sibling item */[m +[31m- i++;[m +[31m- }[m +[31m-[m +[31m- return NULL;[m +[31m-}[m +[31m-[m +[31m-static int motTreeGetUserDataId(Ihandle* ih, void* userdata)[m +[31m-{[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m- ih->data->id_control = -1;[m +[31m- if (motTreeFindUserDataID(ih, &wRoot, 1, userdata))[m +[31m- return ih->data->id_control;[m +[31m- else[m +[31m- return -1;[m +[32m+[m[32m if (call_cb)[m +[32m+[m[32m iupTreeDelFromCache(ih, old_id, old_count-ih->data->node_count);[m + }[m + [m + static void motTreeSetFocusNode(Ihandle* ih, Widget wItem)[m +[36m@@ -737,7 +559,7 @@[m [mstatic void motTreeSetFocusNode(Ihandle* ih, Widget wItem)[m + XmProcessTraversal(wItem, XmTRAVERSE_CURRENT);[m + }[m + [m +[31m-static Widget motTreeGetFocusNode(Ihandle* ih)[m +[32m+[m[32mWidget iupdrvTreeGetFocusNode(Ihandle* ih)[m + {[m + Widget wItem = XmGetFocusWidget(ih->handle); /* returns the focus in the dialog */[m + if (wItem && XtParent(wItem) == ih->handle) /* is a node */[m +[36m@@ -746,18 +568,6 @@[m [mstatic Widget motTreeGetFocusNode(Ihandle* ih)[m + return (Widget)iupAttribGet(ih, "_IUPTREE_LAST_FOCUS");[m + }[m + [m +[31m-static Widget motTreeFindNodeFromString(Ihandle* ih, const char* name_id)[m +[31m-{[m +[31m- if (name_id[0])[m +[31m- {[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m- iupStrToInt(name_id, &ih->data->id_control);[m +[31m- return motTreeFindNodeFromID(ih, &wRoot, 1);[m +[31m- }[m +[31m- else[m +[31m- return motTreeGetFocusNode(ih);[m +[31m-}[m +[31m-[m + static void motTreeEnterLeaveWindowEvent(Widget w, Ihandle *ih, XEvent *evt, Boolean *cont)[m + {[m + if (iupAttribGet(ih, "_IUPTREE_EDITFIELD"))[m +[36m@@ -812,16 +622,24 @@[m [mstatic void motTreeFocusChangeEvent(Widget w, Ihandle *ih, XEvent *evt, Boolean[m + [m + void iupdrvTreeAddNode(Ihandle* ih, const char* name_id, int kind, const char* title, int add)[m + {[m +[31m- Widget wItemPrev = motTreeFindNodeFromString(ih, name_id);[m +[31m- Widget wNewItem;[m +[32m+[m[32m Widget wItemPrev = iupTreeGetNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItemNew;[m + XmString itemTitle;[m +[31m- motTreeItemData *itemData, *itemDataPrev;[m +[32m+[m[32m motTreeItemData *itemData;[m + Pixel bgcolor, fgcolor;[m +[31m- int kindPrev, num_args = 0;[m +[32m+[m[32m int kindPrev = 0, num_args = 0;[m + Arg args[30];[m + [m + if (!wItemPrev)[m +[31m- return;[m +[32m+[m[32m {[m +[32m+[m[32m /* check if the root was really specified */[m +[32m+[m[32m int id = 0;[m +[32m+[m[32m if (!iupStrToInt(name_id, &id) || id != -1)[m +[32m+[m[32m return;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m if (!title)[m +[32m+[m[32m title = "";[m + [m + itemData = calloc(1, sizeof(motTreeItemData));[m + itemData->image = XmUNSPECIFIED_PIXMAP;[m +[36m@@ -836,138 +654,103 @@[m [mvoid iupdrvTreeAddNode(Ihandle* ih, const char* name_id, int kind, const char* t[m + XtVaGetValues(ih->handle, XmNforeground, &fgcolor, NULL);[m + XtVaGetValues(ih->handle, XmNbackground, &bgcolor, NULL);[m + [m +[31m- /* Get the kind of previous item */[m +[31m- XtVaGetValues(wItemPrev, XmNuserData, &itemDataPrev, NULL);[m +[31m- kindPrev = itemDataPrev->kind;[m +[31m-[m +[31m- if (kindPrev == ITREE_BRANCH && add)[m +[32m+[m[32m if (wItemPrev)[m + {[m +[31m- /* wItemPrev is parent of the new item (firstchild of it) */[m +[31m- iupmotSetArg(args, num_args, XmNentryParent, wItemPrev);[m +[31m- iupmotSetArg(args, num_args, XmNpositionIndex, 0);[m +[31m- }[m +[31m- else[m +[31m- {[m +[31m- /* wItemPrev is sibling of the new item (set its parent to the new item) */[m +[31m- Widget wItemParent;[m +[31m- int pos;[m +[32m+[m[32m motTreeItemData *itemDataPrev;[m + [m +[31m- XtVaGetValues(wItemPrev, XmNentryParent, &wItemParent, NULL);[m +[31m- XtVaGetValues(wItemPrev, XmNpositionIndex, &pos, NULL);[m +[32m+[m[32m /* Get the kind of previous item */[m +[32m+[m[32m XtVaGetValues(wItemPrev, XmNuserData, &itemDataPrev, NULL);[m +[32m+[m[32m kindPrev = itemDataPrev->kind;[m +[32m+[m +[32m+[m[32m if (kindPrev == ITREE_BRANCH && add)[m +[32m+[m[32m {[m +[32m+[m[32m /* wItemPrev is parent of the new item (firstchild of it) */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNentryParent, wItemPrev);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNpositionIndex, 0);[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m /* wItemPrev is sibling of the new item (set its parent to the new item) */[m +[32m+[m[32m Widget wItemParent;[m +[32m+[m[32m int pos;[m + [m +[31m- iupmotSetArg(args, num_args, XmNentryParent, wItemParent);[m +[31m- iupmotSetArg(args, num_args, XmNpositionIndex, pos+1);[m +[32m+[m[32m XtVaGetValues(wItemPrev, XmNentryParent, &wItemParent, NULL);[m +[32m+[m[32m XtVaGetValues(wItemPrev, XmNpositionIndex, &pos, NULL);[m +[32m+[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNentryParent, wItemParent);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNpositionIndex, pos+1);[m +[32m+[m[32m }[m + }[m + [m +[31m- iupmotSetArg(args, num_args, XmNuserData, itemData);[m +[31m- iupmotSetArg(args, num_args, XmNforeground, fgcolor);[m +[31m- iupmotSetArg(args, num_args, XmNbackground, bgcolor);[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, ih->data->spacing);[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNviewType, XmSMALL_ICON);[m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[31m- iupmotSetArg(args, num_args, XmNlabelString, itemTitle);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNuserData, itemData);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNforeground, fgcolor);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNbackground, bgcolor);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, ih->data->spacing);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNviewType, XmSMALL_ICON);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlabelString, itemTitle);[m + [m + if (kind == ITREE_BRANCH)[m + {[m + if (ih->data->add_expanded)[m + {[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconPixmap, ih->data->def_image_expanded);[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconMask, ih->data->def_image_expanded_mask);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsmallIconPixmap, ih->data->def_image_expanded);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsmallIconMask, ih->data->def_image_expanded_mask);[m + }[m + else[m + {[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconPixmap, ih->data->def_image_collapsed);[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconMask, ih->data->def_image_collapsed_mask);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsmallIconPixmap, ih->data->def_image_collapsed);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsmallIconMask, ih->data->def_image_collapsed_mask);[m + }[m + }[m + else[m + {[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconPixmap, ih->data->def_image_leaf);[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconMask, ih->data->def_image_leaf_mask);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsmallIconPixmap, ih->data->def_image_leaf);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsmallIconMask, ih->data->def_image_leaf_mask);[m + }[m + [m +[32m+[m[32m /* Add the new node */[m +[32m+[m[32m wItemNew = XtCreateManagedWidget("icon", xmIconGadgetClass, ih->handle, args, num_args);[m +[32m+[m[32m if (wItemPrev)[m +[32m+[m[32m iupTreeAddToCache(ih, add, kindPrev, wItemPrev, wItemNew);[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m iupTreeAddToCache(ih, 0, 0, NULL, wItemNew);[m +[32m+[m +[32m+[m[32m if (ih->data->node_count == 1)[m +[32m+[m[32m {[m +[32m+[m[32m /* MarkStart node */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_MARKSTART_NODE", (char*)wItemNew);[m + [m +[31m- wNewItem = XtCreateManagedWidget("icon", xmIconGadgetClass, ih->handle, args, num_args);[m +[32m+[m[32m /* Set the default VALUE */[m +[32m+[m[32m motTreeSetFocusNode(ih, wItemNew);[m +[32m+[m[32m }[m +[32m+[m[32m }[m + [m + if (kind == ITREE_BRANCH)[m + {[m +[32m+[m[32m iupAttribSetStr(ih, "_IUP_IGNORE_BRANCH_CB", "1");[m + if (ih->data->add_expanded)[m +[31m- {[m +[31m- iupAttribSetStr(ih, "_IUP_IGNORE_BRANCHOPEN", "1");[m +[31m- XtVaSetValues(wNewItem, XmNoutlineState, XmEXPANDED, NULL);[m +[31m- }[m +[32m+[m[32m XtVaSetValues(wItemNew, XmNoutlineState, XmEXPANDED, NULL);[m + else[m +[31m- XtVaSetValues(wNewItem, XmNoutlineState, XmCOLLAPSED, NULL);[m +[32m+[m[32m XtVaSetValues(wItemNew, XmNoutlineState, XmCOLLAPSED, NULL);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUP_IGNORE_BRANCH_CB", NULL);[m + }[m + [m +[31m- /* Root always expanded */[m +[31m- XtVaSetValues((Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM"), XmNoutlineState, XmEXPANDED, NULL);[m +[31m-[m +[31m- XtRealizeWidget(wNewItem);[m +[32m+[m[32m XtRealizeWidget(wItemNew);[m + XmStringFree(itemTitle);[m + }[m + [m +[31m-static void motTreeAddRootNode(Ihandle* ih)[m +[31m-{[m +[31m- Widget wRootItem;[m +[31m- motTreeItemData *itemData;[m +[31m- Pixel bgcolor, fgcolor;[m +[31m- int num_args = 0;[m +[31m- Arg args[30];[m +[31m-[m +[31m- itemData = calloc(1, sizeof(motTreeItemData));[m +[31m- itemData->image = XmUNSPECIFIED_PIXMAP;[m +[31m- itemData->image_expanded = XmUNSPECIFIED_PIXMAP;[m +[31m- itemData->image_mask = XmUNSPECIFIED_PIXMAP;[m +[31m- itemData->image_expanded_mask = XmUNSPECIFIED_PIXMAP;[m +[31m- itemData->kind = ITREE_BRANCH;[m +[31m-[m +[31m- /* Get default foreground color */[m +[31m- XtVaGetValues(ih->handle, XmNforeground, &fgcolor, NULL);[m +[31m- XtVaGetValues(ih->handle, XmNbackground, &bgcolor, NULL);[m +[31m-[m +[31m- iupmotSetArg(args, num_args, XmNentryParent, NULL);[m +[31m- iupmotSetArg(args, num_args, XmNuserData, itemData);[m +[31m- iupmotSetArg(args, num_args, XmNforeground, fgcolor);[m +[31m- iupmotSetArg(args, num_args, XmNbackground, bgcolor);[m +[31m- iupmotSetArg(args, num_args, XmNoutlineState, XmEXPANDED);[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, ih->data->spacing);[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNviewType, XmSMALL_ICON);[m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconPixmap, ih->data->def_image_expanded);[m +[31m- iupmotSetArg(args, num_args, XmNsmallIconMask, ih->data->def_image_expanded_mask);[m +[31m-[m +[31m- wRootItem = XtCreateManagedWidget("icon", xmIconGadgetClass, ih->handle, args, num_args);[m +[31m-[m +[31m- /* Select the new item */[m +[31m- XtVaSetValues(wRootItem, XmNvisualEmphasis, XmSELECTED, NULL);[m +[31m-[m +[31m- XtRealizeWidget(wRootItem);[m +[31m-[m +[31m- /* Save the root node for later use */[m +[31m- iupAttribSetStr(ih, "_IUPTREE_ROOTITEM", (char*)wRootItem);[m +[31m-[m +[31m- /* MarkStart node */[m +[31m- iupAttribSetStr(ih, "_IUPTREE_MARKSTART_NODE", (char*)wRootItem);[m +[31m-[m +[31m- /* Set the default VALUE */[m +[31m- /* In Motif this will set also the current focus */[m +[31m- motTreeSetFocusNode(ih, wRootItem);[m +[31m-}[m +[31m-[m + /*****************************************************************************/[m + [m + static int motTreeSetImageExpandedAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m + motTreeItemData *itemData;[m + unsigned char itemState;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem)[m + return 0;[m + [m +[36m@@ -1003,7 +786,7 @@[m [mstatic int motTreeSetImageExpandedAttrib(Ihandle* ih, const char* name_id, const[m + static int motTreeSetImageAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m + motTreeItemData *itemData;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return 0;[m + [m +[36m@@ -1053,7 +836,6 @@[m [mstatic int motTreeSetImageAttrib(Ihandle* ih, const char* name_id, const char* v[m + [m + static int motTreeSetImageBranchExpandedAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m + ih->data->def_image_expanded = iupImageGetImage(value, ih, 0);[m + if (!ih->data->def_image_expanded) [m + {[m +[36m@@ -1067,14 +849,13 @@[m [mstatic int motTreeSetImageBranchExpandedAttrib(Ihandle* ih, const char* value)[m + }[m + [m + /* Update all images, starting at root node */[m +[31m- motTreeUpdateImages(ih, &wRoot, 1, ITREE_UPDATEIMAGE_EXPANDED);[m +[32m+[m[32m motTreeUpdateImages(ih, ITREE_UPDATEIMAGE_EXPANDED);[m + [m + return 1;[m + }[m + [m + static int motTreeSetImageBranchCollapsedAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m + ih->data->def_image_collapsed = iupImageGetImage(value, ih, 0);[m + if (!ih->data->def_image_collapsed) [m + {[m +[36m@@ -1088,14 +869,13 @@[m [mstatic int motTreeSetImageBranchCollapsedAttrib(Ihandle* ih, const char* value)[m + }[m + [m + /* Update all images, starting at root node */[m +[31m- motTreeUpdateImages(ih, &wRoot, 1, ITREE_UPDATEIMAGE_COLLAPSED);[m +[32m+[m[32m motTreeUpdateImages(ih, ITREE_UPDATEIMAGE_COLLAPSED);[m + [m + return 1;[m + }[m + [m + static int motTreeSetImageLeafAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m + ih->data->def_image_leaf = iupImageGetImage(value, ih, 0);[m + if (!ih->data->def_image_leaf) [m + {[m +[36m@@ -1109,7 +889,7 @@[m [mstatic int motTreeSetImageLeafAttrib(Ihandle* ih, const char* value)[m + }[m + [m + /* Update all images, starting at root node */[m +[31m- motTreeUpdateImages(ih, &wRoot, 1, ITREE_UPDATEIMAGE_LEAF);[m +[32m+[m[32m motTreeUpdateImages(ih, ITREE_UPDATEIMAGE_LEAF);[m + [m + return 1;[m + }[m +[36m@@ -1118,7 +898,7 @@[m [mstatic char* motTreeGetStateAttrib(Ihandle* ih, const char* name_id)[m + {[m + int hasChildren;[m + unsigned char itemState;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return 0;[m + [m +[36m@@ -1138,14 +918,21 @@[m [mstatic char* motTreeGetStateAttrib(Ihandle* ih, const char* name_id)[m + [m + static int motTreeSetStateAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[31m- if (!wItem) [m +[32m+[m[32m motTreeItemData *itemData;[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m +[32m+[m[32m if (!wItem)[m + return 0;[m + [m +[31m- if (iupStrEqualNoCase(value, "EXPANDED"))[m +[31m- XtVaSetValues(wItem, XmNoutlineState, XmEXPANDED, NULL);[m +[31m- else [m +[31m- XtVaSetValues(wItem, XmNoutlineState, XmCOLLAPSED, NULL);[m +[32m+[m[32m XtVaGetValues(wItem, XmNuserData, &itemData, NULL);[m +[32m+[m[32m if (itemData->kind == ITREE_BRANCH)[m +[32m+[m[32m {[m +[32m+[m[32m iupAttribSetStr(ih, "_IUP_IGNORE_BRANCH_CB", "1");[m +[32m+[m[32m if (iupStrEqualNoCase(value, "EXPANDED"))[m +[32m+[m[32m XtVaSetValues(wItem, XmNoutlineState, XmEXPANDED, NULL);[m +[32m+[m[32m else[m[41m [m +[32m+[m[32m XtVaSetValues(wItem, XmNoutlineState, XmCOLLAPSED, NULL);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUP_IGNORE_BRANCH_CB", NULL);[m +[32m+[m[32m }[m + [m + return 0;[m + }[m +[36m@@ -1155,7 +942,7 @@[m [mstatic char* motTreeGetColorAttrib(Ihandle* ih, const char* name_id)[m + unsigned char r, g, b;[m + Pixel color;[m + char* str;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id); [m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m[41m [m + if (!wItem) [m + return NULL;[m + [m +[36m@@ -1170,7 +957,7 @@[m [mstatic char* motTreeGetColorAttrib(Ihandle* ih, const char* name_id)[m + static int motTreeSetColorAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m + Pixel color;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id); [m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m[41m [m + if (!wItem) [m + return 0;[m + [m +[36m@@ -1182,36 +969,33 @@[m [mstatic int motTreeSetColorAttrib(Ihandle* ih, const char* name_id, const char* v[m + [m + static char* motTreeGetDepthAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- Widget wRoot;[m +[31m- int dep = 0;[m +[31m- char* depth;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id); [m +[32m+[m[32m int depth = -1;[m +[32m+[m[32m char* str;[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m[41m [m + if (!wItem) [m + return NULL;[m + [m +[31m- wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m-[m +[31m- while((wRoot != wItem) && (wItem != NULL))[m +[32m+[m[32m while(wItem != NULL)[m + {[m + XtVaGetValues(wItem, XmNentryParent, &wItem, NULL);[m +[31m- dep++;[m +[32m+[m[32m depth++;[m + }[m + [m +[31m- depth = iupStrGetMemory(10);[m +[31m- sprintf(depth, "%d", dep);[m +[31m- return depth;[m +[32m+[m[32m str = iupStrGetMemory(10);[m +[32m+[m[32m sprintf(str, "%d", depth);[m +[32m+[m[32m return str;[m + }[m + [m + static int motTreeSetMoveNodeAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m + Widget wItemDst, wParent, wItemSrc;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m +[31m- wItemSrc = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m wItemSrc = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItemSrc)[m + return 0;[m +[31m- wItemDst = motTreeFindNodeFromString(ih, value);[m +[32m+[m[32m wItemDst = iupTreeGetNodeFromString(ih, value);[m + if (!wItemDst)[m + return 0;[m + [m +[36m@@ -1224,11 +1008,8 @@[m [mstatic int motTreeSetMoveNodeAttrib(Ihandle* ih, const char* name_id, const char[m + return 0;[m + }[m + [m +[31m- /* Copying the node and its children to the new position */[m +[31m- motTreeCopyNode(ih, wItemSrc, wItemDst, 0); /* not a full copy, preserve user data */[m +[31m-[m +[31m- /* Deleting the node (and its children) inserted into the old position */[m +[31m- motTreeRemoveNode(ih, wItemSrc, 0); /* do not delete the user data, we copy the references in CopyNode */[m +[32m+[m[32m /* Move the node and its children to the new position */[m +[32m+[m[32m motTreeCopyMoveNode(ih, wItemSrc, wItemDst, 0);[m + [m + return 0;[m + }[m +[36m@@ -1237,12 +1018,12 @@[m [mstatic int motTreeSetCopyNodeAttrib(Ihandle* ih, const char* name_id, const char[m + {[m + Widget wItemDst, wParent, wItemSrc;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m +[31m- wItemSrc = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m wItemSrc = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItemSrc)[m + return 0;[m +[31m- wItemDst = motTreeFindNodeFromString(ih, value);[m +[32m+[m[32m wItemDst = iupTreeGetNodeFromString(ih, value);[m + if (!wItemDst)[m + return 0;[m + [m +[36m@@ -1255,8 +1036,8 @@[m [mstatic int motTreeSetCopyNodeAttrib(Ihandle* ih, const char* name_id, const char[m + return 0;[m + }[m + [m +[31m- /* Copying the node and its children to the new position */[m +[31m- motTreeCopyNode(ih, wItemSrc, wItemDst, 1);[m +[32m+[m[32m /* Copy the node and its children to the new position */[m +[32m+[m[32m motTreeCopyMoveNode(ih, wItemSrc, wItemDst, 1);[m + [m + return 0;[m + }[m +[36m@@ -1265,7 +1046,7 @@[m [mstatic char* motTreeGetParentAttrib(Ihandle* ih, const char* name_id)[m + {[m + Widget wItemParent;[m + char* str;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return NULL;[m + [m +[36m@@ -1275,7 +1056,7 @@[m [mstatic char* motTreeGetParentAttrib(Ihandle* ih, const char* name_id)[m + return NULL;[m + [m + str = iupStrGetMemory(10);[m +[31m- sprintf(str, "%d", motTreeGetNodeId(ih, wItemParent));[m +[32m+[m[32m sprintf(str, "%d", iupTreeFindNodeId(ih, wItemParent));[m + return str;[m + }[m + [m +[36m@@ -1283,7 +1064,7 @@[m [mstatic char* motTreeGetChildCountAttrib(Ihandle* ih, const char* name_id)[m + {[m + char* str;[m + WidgetList wList = NULL;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return NULL;[m + [m +[36m@@ -1293,30 +1074,10 @@[m [mstatic char* motTreeGetChildCountAttrib(Ihandle* ih, const char* name_id)[m + return str;[m + }[m + [m +[31m-static int motTreeCount(Ihandle* ih, Widget wItem)[m +[31m-{[m +[31m- WidgetList wList = NULL;[m +[31m- int i, count = 0;[m +[31m- int childCount = XmContainerGetItemChildren(ih->handle, wItem, &wList);[m +[31m- count++;[m +[31m- for (i=0; i<childCount; i++)[m +[31m- count += motTreeCount(ih, wList[i]);[m +[31m- if (wList) XtFree((char*)wList);[m +[31m- return count;[m +[31m-}[m +[31m-[m +[31m-static char* motTreeGetCountAttrib(Ihandle* ih)[m +[31m-{[m +[31m- char* str = iupStrGetMemory(10);[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m- sprintf(str, "%d", motTreeCount(ih, wRoot));[m +[31m- return str;[m +[31m-}[m +[31m-[m + static char* motTreeGetKindAttrib(Ihandle* ih, const char* name_id)[m + {[m + motTreeItemData *itemData;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return NULL;[m + [m +[36m@@ -1331,15 +1092,64 @@[m [mstatic char* motTreeGetKindAttrib(Ihandle* ih, const char* name_id)[m + static char* motTreeGetValueAttrib(Ihandle* ih)[m + {[m + char* str;[m +[31m- Widget wItem = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wItem = iupdrvTreeGetFocusNode(ih);[m + if (!wItem)[m +[31m- return "0"; /* default VALUE is root */[m +[32m+[m[32m {[m +[32m+[m[32m if (ih->data->node_count)[m +[32m+[m[32m return "0"; /* default VALUE is root */[m +[32m+[m[32m else[m +[32m+[m[32m return "-1";[m +[32m+[m[32m }[m + [m + str = iupStrGetMemory(10);[m +[31m- sprintf(str, "%d", motTreeGetNodeId(ih, wItem));[m +[32m+[m[32m sprintf(str, "%d", iupTreeFindNodeId(ih, wItem));[m +[32m+[m[32m return str;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic char* motTreeGetMarkedNodesAttrib(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m char* str;[m +[32m+[m[32m int i;[m +[32m+[m +[32m+[m[32m if (ih->data->mark_mode==ITREE_MARK_SINGLE)[m +[32m+[m[32m return NULL;[m +[32m+[m +[32m+[m[32m str = iupStrGetMemory(ih->data->node_count+1);[m +[32m+[m +[32m+[m[32m for (i=0; i<ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (motTreeIsNodeSelected(ih->data->node_cache[i].node_handle))[m +[32m+[m[32m str[i] = '+';[m +[32m+[m[32m else[m +[32m+[m[32m str[i] = '-';[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m str[ih->data->node_count] = 0;[m + return str;[m + }[m + [m +[32m+[m[32mstatic int motTreeSetMarkedNodesAttrib(Ihandle* ih, const char* value)[m +[32m+[m[32m{[m +[32m+[m[32m int count, i;[m +[32m+[m +[32m+[m[32m if (ih->data->mark_mode==ITREE_MARK_SINGLE || !value)[m +[32m+[m[32m return 0;[m +[32m+[m +[32m+[m[32m count = strlen(value);[m +[32m+[m[32m if (count > ih->data->node_count)[m +[32m+[m[32m count = ih->data->node_count;[m +[32m+[m +[32m+[m[32m for (i=0; i<count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (value[i] == '+')[m +[32m+[m[32m XtVaSetValues(ih->data->node_cache[i].node_handle, XmNvisualEmphasis, XmSELECTED, NULL);[m +[32m+[m[32m else[m +[32m+[m[32m XtVaSetValues(ih->data->node_cache[i].node_handle, XmNvisualEmphasis, XmNOT_SELECTED, NULL);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m return 0;[m +[32m+[m[32m}[m +[32m+[m + static int motTreeSetMarkAttrib(Ihandle* ih, const char* value)[m + {[m + if (ih->data->mark_mode==ITREE_MARK_SINGLE)[m +[36m@@ -1353,21 +1163,16 @@[m [mstatic int motTreeSetMarkAttrib(Ihandle* ih, const char* value)[m + motTreeInvertAllNodeMarking(ih);[m + else if(iupStrEqualPartial(value, "INVERT"))[m + {[m +[31m- unsigned char isSelected;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, &value[strlen("INVERT")]);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, &value[strlen("INVERT")]);[m + if (!wItem) [m + return 0;[m + [m +[31m- XtVaGetValues(wItem, XmNvisualEmphasis, &isSelected, NULL);[m +[31m- if (isSelected == XmSELECTED)[m +[31m- XtVaSetValues(wItem, XmNvisualEmphasis, XmNOT_SELECTED, NULL);[m +[31m- else[m +[31m- XtVaSetValues(wItem, XmNvisualEmphasis, XmSELECTED, NULL);[m +[32m+[m[32m motTreeSelectNode(wItem, -1);[m + }[m + else if(iupStrEqualNoCase(value, "BLOCK"))[m + {[m + Widget wItem = (Widget)iupAttribGet(ih, "_IUPTREE_MARKSTART_NODE");[m +[31m- Widget wFocusItem = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wFocusItem = iupdrvTreeGetFocusNode(ih);[m + if(!wFocusItem || !wItem)[m + return 0;[m + motTreeSelectRange(ih, wFocusItem, wItem, 0);[m +[36m@@ -1379,10 +1184,10 @@[m [mstatic int motTreeSetMarkAttrib(Ihandle* ih, const char* value)[m + if (iupStrToStrStr(value, str1, str2, '-')!=2)[m + return 0;[m + [m +[31m- wItem1 = motTreeFindNodeFromString(ih, str1);[m +[32m+[m[32m wItem1 = iupTreeGetNodeFromString(ih, str1);[m + if (!wItem1) [m + return 0;[m +[31m- wItem2 = motTreeFindNodeFromString(ih, str2);[m +[32m+[m[32m wItem2 = iupTreeGetNodeFromString(ih, str2);[m + if (!wItem2) [m + return 0;[m + [m +[36m@@ -1394,69 +1199,49 @@[m [mstatic int motTreeSetMarkAttrib(Ihandle* ih, const char* value)[m + [m + static int motTreeSetValueAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- Widget wRoot, wItem;[m +[32m+[m[32m Widget wItem, wItemParent;[m + [m + if (motTreeSetMarkAttrib(ih, value))[m + return 0;[m + [m +[31m- wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m-[m +[31m- if (iupStrEqualNoCase(value, "ROOT"))[m +[31m- wItem = wRoot;[m +[32m+[m[32m if (iupStrEqualNoCase(value, "ROOT") || iupStrEqualNoCase(value, "FIRST"))[m +[32m+[m[32m wItem = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m + else if(iupStrEqualNoCase(value, "LAST"))[m +[31m- wItem = motTreeGetLastVisibleNode(ih, wRoot);[m +[32m+[m[32m wItem = motTreeGetLastVisibleNode(ih);[m + else if(iupStrEqualNoCase(value, "PGUP"))[m + {[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m + if(!wItemFocus)[m + return 0;[m + [m +[31m- ih->data->id_control = -1;[m +[31m- motTreeFindVisibleNodeId(ih, &wRoot, 1, wItemFocus);[m +[31m- ih->data->id_control -= 10; /* less 10 visible nodes */[m +[31m-[m +[31m- if(ih->data->id_control < 0)[m +[31m- ih->data->id_control = 0; /* Begin of tree = Root id */[m +[31m-[m +[31m- wItem = motTreeFindVisibleNodeFromId(ih, &wRoot, 1);[m +[32m+[m[32m wItem = motTreeGetPreviousVisibleNode(ih, wItemFocus, 10);[m + }[m + else if(iupStrEqualNoCase(value, "PGDN"))[m + {[m +[31m- Widget wNext, wItemFocus;[m +[31m-[m +[31m- wItemFocus = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m + if(!wItemFocus)[m + return 0;[m + [m +[31m- ih->data->id_control = -1;[m +[31m- motTreeFindVisibleNodeId(ih, &wRoot, 1, wItemFocus);[m +[31m- ih->data->id_control += 10; /* more 10 visible nodes */[m +[31m-[m +[31m- wNext = motTreeFindVisibleNodeFromId(ih, &wRoot, 1);[m +[31m-[m +[31m- if (ih->data->id_control >= 0)[m +[31m- wNext = motTreeGetLastVisibleNode(ih, wRoot);[m +[31m- [m +[31m- wItem = wNext;[m +[32m+[m[32m wItem = motTreeGetNextVisibleNode(ih, wItemFocus, 10);[m + }[m + else if(iupStrEqualNoCase(value, "NEXT"))[m + {[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m + if (!wItemFocus)[m + return 0;[m + [m +[31m- wItem = motTreeGetNextVisibleNode(ih, wRoot, wItemFocus);[m +[32m+[m[32m wItem = motTreeGetNextVisibleNode(ih, wItemFocus, 1);[m + }[m + else if(iupStrEqualNoCase(value, "PREVIOUS"))[m + {[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m + if(!wItemFocus)[m + return 0;[m + [m +[31m- wItem = motTreeGetPreviousVisibleNode(ih, wRoot, wItemFocus);[m +[32m+[m[32m wItem = motTreeGetPreviousVisibleNode(ih, wItemFocus, 1);[m + }[m + else[m +[31m- wItem = motTreeFindNodeFromString(ih, value);[m +[32m+[m[32m wItem = iupTreeGetNodeFromString(ih, value);[m + [m + if (!wItem) [m + return 0;[m +[36m@@ -1471,17 +1256,26 @@[m [mstatic int motTreeSetValueAttrib(Ihandle* ih, const char* value)[m + XtVaSetValues(wItem, XmNvisualEmphasis, XmSELECTED, NULL);[m + }[m + [m +[32m+[m +[32m+[m[32m /* expand all parents */[m +[32m+[m[32m XtVaGetValues(wItem, XmNentryParent, &wItemParent, NULL);[m +[32m+[m[32m while(wItemParent)[m +[32m+[m[32m {[m +[32m+[m[32m XtVaSetValues(wItemParent, XmNoutlineState, XmEXPANDED, NULL);[m +[32m+[m[32m XtVaGetValues(wItemParent, XmNentryParent, &wItemParent, NULL);[m +[32m+[m[32m }[m +[32m+[m + /* set focus (will scroll to visible) */[m + motTreeSetFocusNode(ih, wItem);[m + [m +[31m- iupAttribSetInt(ih, "_IUPTREE_OLDVALUE", motTreeGetNodeId(ih, wItem));[m +[32m+[m[32m iupAttribSetInt(ih, "_IUPTREE_OLDVALUE", iupTreeFindNodeId(ih, wItem));[m + [m + return 0;[m + } [m + [m + static int motTreeSetMarkStartAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return 0;[m + [m +[36m@@ -1492,14 +1286,11 @@[m [mstatic int motTreeSetMarkStartAttrib(Ihandle* ih, const char* name_id)[m + [m + static char* motTreeGetMarkedAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- unsigned char isSelected;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return NULL;[m + [m +[31m- XtVaGetValues(wItem, XmNvisualEmphasis, &isSelected, NULL);[m +[31m-[m +[31m- if(isSelected == XmSELECTED)[m +[32m+[m[32m if (motTreeIsNodeSelected(wItem))[m + return "YES";[m + else[m + return "NO";[m +[36m@@ -1507,7 +1298,7 @@[m [mstatic char* motTreeGetMarkedAttrib(Ihandle* ih, const char* name_id)[m + [m + static int motTreeSetMarkedAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return 0;[m + [m +[36m@@ -1531,7 +1322,7 @@[m [mstatic char* motTreeGetTitle(Widget wItem)[m + [m + static char* motTreeGetTitleAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return NULL;[m + return motTreeGetTitle(wItem);[m +[36m@@ -1539,10 +1330,13 @@[m [mstatic char* motTreeGetTitleAttrib(Ihandle* ih, const char* name_id)[m + [m + static int motTreeSetTitleAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return 0;[m + [m +[32m+[m[32m if (!value)[m +[32m+[m[32m value = "";[m +[32m+[m + iupmotSetString(wItem, XmNlabelString, value);[m + [m + return 0;[m +[36m@@ -1551,7 +1345,7 @@[m [mstatic int motTreeSetTitleAttrib(Ihandle* ih, const char* name_id, const char* v[m + static int motTreeSetTitleFontAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m + XmFontList fontlist = NULL;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return 0;[m + [m +[36m@@ -1569,7 +1363,7 @@[m [mstatic int motTreeSetTitleFontAttrib(Ihandle* ih, const char* name_id, const cha[m + static char* motTreeGetTitleFontAttrib(Ihandle* ih, const char* name_id)[m + {[m + XmFontList fontlist;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!wItem) [m + return NULL;[m + [m +[36m@@ -1577,118 +1371,81 @@[m [mstatic char* motTreeGetTitleFontAttrib(Ihandle* ih, const char* name_id)[m + return iupmotFindFontList(fontlist);[m + }[m + [m +[31m-static char* motTreeGetFindUserDataAttrib(Ihandle* ih, const char* name_id)[m +[31m-{[m +[31m- int id;[m +[31m- char* str = (char*)(name_id+1); /* skip ':' */[m +[31m- void* userdata = NULL;[m +[31m- if (sscanf(str, "%p", &userdata)!=1)[m +[31m- return NULL;[m +[31m- id = motTreeGetUserDataId(ih, userdata);[m +[31m- if (id == -1)[m +[31m- return NULL;[m +[31m- str = iupStrGetMemory(16);[m +[31m- sprintf(str, "%d", id);[m +[31m- return str;[m +[31m-}[m +[31m-[m +[31m-static char* motTreeGetUserDataAttrib(Ihandle* ih, const char* name_id)[m +[31m-{[m +[31m- motTreeItemData *itemData;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[31m- if (!wItem) [m +[31m- return NULL;[m +[31m-[m +[31m- XtVaGetValues(wItem, XmNuserData, &itemData, NULL);[m +[31m-[m +[31m- return itemData->userdata;[m +[31m-}[m +[31m-[m +[31m-static int motTreeSetUserDataAttrib(Ihandle* ih, const char* name_id, const char* value)[m +[31m-{[m +[31m- motTreeItemData *itemData;[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[31m- if (!wItem) [m +[31m- return 0;[m +[31m-[m +[31m- XtVaGetValues(wItem, XmNuserData, &itemData, NULL);[m +[31m- itemData->userdata = (void*)value;[m +[31m-[m +[31m- return 0;[m +[31m-}[m +[31m-[m + static int motTreeSetRenameAttrib(Ihandle* ih, const char* value)[m + { [m + if (ih->data->show_rename)[m + {[m +[31m- IFni cbShowRename = (IFni)IupGetCallback(ih, "SHOWRENAME_CB");[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[31m- if (cbShowRename)[m +[31m- cbShowRename(ih, motTreeGetNodeId(ih, wItemFocus));[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m + motTreeShowEditField(ih, wItemFocus);[m + }[m +[31m- else[m +[31m- {[m +[31m- IFnis cbRenameNode = (IFnis)IupGetCallback(ih, "RENAMENODE_CB");[m +[31m- if (cbRenameNode)[m +[31m- {[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[31m- cbRenameNode(ih, motTreeGetNodeId(ih, wItemFocus), motTreeGetTitle(wItemFocus)); [m +[31m- }[m +[31m- }[m + [m + (void)value;[m + return 0;[m + }[m + [m +[32m+[m[32mstatic void motTreeRemoveAllNodes(Ihandle* ih, int call_cb)[m +[32m+[m[32m{[m +[32m+[m[32m IFns cb = call_cb? (IFns)IupGetCallback(ih, "NODEREMOVED_CB"): NULL;[m +[32m+[m[32m int i, old_count = ih->data->node_count;[m +[32m+[m[32m Widget wItem;[m +[32m+[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m wItem = ih->data->node_cache[i].node_handle;[m +[32m+[m +[32m+[m[32m motTreeDestroyItemData(ih, wItem, 1, cb, i);[m +[32m+[m +[32m+[m[32m XtDestroyWidget(wItem); /* must manually destroy each node, this is NOT recursive */[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m ih->data->node_count = 0;[m +[32m+[m +[32m+[m[32m if (call_cb)[m +[32m+[m[32m iupTreeDelFromCache(ih, 0, old_count);[m +[32m+[m[32m}[m +[32m+[m + static int motTreeSetDelNodeAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m +[31m- if(iupStrEqualNoCase(value, "SELECTED")) /* selected here means the specified one */[m +[32m+[m[32m if (iupStrEqualNoCase(value, "ALL"))[m + {[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m-[m +[31m- /* the root node can't be deleted */[m +[31m- if(!wItem || wItem == wRoot) /* root is the unique child */[m +[32m+[m[32m motTreeRemoveAllNodes(ih, 1);[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m[32m if(iupStrEqualNoCase(value, "SELECTED")) /* selected here means the reference node */[m +[32m+[m[32m {[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m +[32m+[m[32m if(!wItem)[m + return 0;[m + [m +[31m- /* deleting the specified node (and it's children) */[m +[31m- motTreeRemoveNode(ih, wItem, 1);[m +[32m+[m[32m /* deleting the reference node (and it's children) */[m +[32m+[m[32m motTreeRemoveNode(ih, wItem, 1, 1);[m + }[m +[31m- else if(iupStrEqualNoCase(value, "CHILDREN")) /* children of the specified one */[m +[32m+[m[32m else if(iupStrEqualNoCase(value, "CHILDREN")) /* children of the reference node */[m + {[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m int numChild, i;[m +[32m+[m[32m WidgetList wItemList = NULL;[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, name_id);[m + [m + if(!wItem)[m + return 0;[m + [m +[31m- {[m +[31m- /* deleting the selected node's children only */[m +[31m- WidgetList wItemList = NULL;[m +[31m- int numChild = XmContainerGetItemChildren(ih->handle, wItem, &wItemList);[m +[31m- if(numChild)[m +[31m- motTreeRemoveChildren(ih, wItemList, numChild, 1);[m +[31m- if (wItemList) XtFree((char*)wItemList);[m +[31m- }[m +[32m+[m[32m /* deleting the reference node children only */[m +[32m+[m[32m numChild = XmContainerGetItemChildren(ih->handle, wItem, &wItemList);[m +[32m+[m[32m for(i = 0; i < numChild; i++)[m +[32m+[m[32m motTreeRemoveNode(ih, wItemList[i], 1, 1);[m +[32m+[m[32m if (wItemList) XtFree((char*)wItemList);[m + }[m + else if(iupStrEqualNoCase(value, "MARKED")) /* Delete the array of marked nodes */[m + {[m +[31m- WidgetList wSelectedItemList = NULL;[m +[31m- Widget wRoot;[m +[31m- int countItems, i;[m +[31m-[m +[31m- XtVaGetValues(ih->handle, XmNselectedObjects, &wSelectedItemList,[m +[31m- XmNselectedObjectCount, &countItems, NULL);[m +[31m-[m +[31m- wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m-[m +[31m- for(i = 0; i < countItems; i++)[m +[32m+[m[32m int i;[m +[32m+[m[32m for(i = 1; i < ih->data->node_count; /* increment only if not removed */)[m + {[m +[31m- int ok = XmIsIconGadget(wSelectedItemList[i]);[m +[31m- if ((wSelectedItemList[i] != wRoot) && ok) /* the root node can't be deleted */[m +[31m- motTreeRemoveNode(ih, wSelectedItemList[i], 1);[m +[32m+[m[32m if (motTreeIsNodeSelected(ih->data->node_cache[i].node_handle))[m +[32m+[m[32m motTreeRemoveNode(ih, ih->data->node_cache[i].node_handle, 1, 1);[m +[32m+[m[32m else[m +[32m+[m[32m i++;[m + }[m + }[m + [m +[36m@@ -1714,7 +1471,7 @@[m [mstatic int motTreeSetIndentationAttrib(Ihandle* ih, const char* value)[m + [m + static int motTreeSetTopItemAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- Widget wItem = motTreeFindNodeFromString(ih, value);[m +[32m+[m[32m Widget wItem = iupTreeGetNodeFromString(ih, value);[m + Widget sb_win;[m + Widget wItemParent;[m + [m +[36m@@ -1735,10 +1492,11 @@[m [mstatic int motTreeSetTopItemAttrib(Ihandle* ih, const char* value)[m + return 0;[m + }[m + [m +[31m-static int motTreeSpacingFunc(Ihandle* ih, Widget wItem, void *data)[m +[32m+[m[32mstatic int motTreeSpacingFunc(Ihandle* ih, Widget wItem, int id, void *data)[m + {[m + XtVaSetValues(wItem, XmNmarginHeight, ih->data->spacing, NULL);[m + (void)data;[m +[32m+[m[32m (void)id;[m + return 1;[m + }[m + [m +[36m@@ -1752,7 +1510,7 @@[m [mstatic int motTreeSetSpacingAttrib(Ihandle* ih, const char* value)[m + [m + if (ih->handle)[m + {[m +[31m- motTreeForEach(ih, NULL, (motTreeNodeFunc)motTreeSpacingFunc, 0);[m +[32m+[m[32m iupTreeForEach(ih, (iupTreeNodeFunc)motTreeSpacingFunc, 0);[m + return 0;[m + }[m + else[m +[36m@@ -1761,17 +1519,10 @@[m [mstatic int motTreeSetSpacingAttrib(Ihandle* ih, const char* value)[m + [m + static int motTreeSetExpandAllAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m-[m + if (iupStrBoolean(value))[m +[31m- motTreeExpandCollapseAllNodes(ih, &wRoot, 1, XmEXPANDED);[m +[32m+[m[32m motTreeExpandCollapseAllNodes(ih, XmEXPANDED);[m + else[m +[31m- {[m +[31m- motTreeExpandCollapseAllNodes(ih, &wRoot, 1, XmCOLLAPSED);[m +[31m-[m +[31m- /* The root node is always expanded */[m +[31m- XtVaSetValues((Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM"), XmNoutlineState, XmEXPANDED, NULL);[m +[31m- }[m +[32m+[m[32m motTreeExpandCollapseAllNodes(ih, XmCOLLAPSED);[m + [m + return 0;[m + }[m +[36m@@ -1801,16 +1552,13 @@[m [mstatic int motTreeSetBgColorAttrib(Ihandle* ih, const char* value)[m + color = iupmotColorGetPixelStr(value);[m + if (color != (Pixel)-1)[m + {[m +[31m- Widget wRoot;[m + Widget clipwin = NULL;[m + [m + XtVaGetValues(sb_win, XmNclipWindow, &clipwin, NULL);[m + if (clipwin) iupmotSetBgColor(clipwin, color);[m + [m +[31m- wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[31m- [m + /* Update all children, starting at root node */[m +[31m- motTreeUpdateBgColor(ih, &wRoot, 1, color);[m +[32m+[m[32m motTreeUpdateBgColor(ih, color);[m + }[m + [m + iupdrvBaseSetBgColorAttrib(ih, value); /* use given value for contents */[m +[36m@@ -1871,10 +1619,14 @@[m [mstatic void motTreeSetRenameSelectionPos(Widget cbEdit, const char* value)[m + [m + static int motTreeCallBranchCloseCb(Ihandle* ih, Widget wItem)[m + {[m +[31m- IFni cbBranchClose = (IFni)IupGetCallback(ih, "BRANCHCLOSE_CB");[m +[32m+[m[32m IFni cbBranchClose;[m +[32m+[m +[32m+[m[32m if (iupAttribGet(ih, "_IUP_IGNORE_BRANCH_CB"))[m +[32m+[m[32m return IUP_DEFAULT;[m + [m +[31m- if(cbBranchClose)[m +[31m- return cbBranchClose(ih, motTreeGetNodeId(ih, wItem));[m +[32m+[m[32m cbBranchClose = (IFni)IupGetCallback(ih, "BRANCHCLOSE_CB");[m +[32m+[m[32m if (cbBranchClose)[m +[32m+[m[32m return cbBranchClose(ih, iupTreeFindNodeId(ih, wItem));[m + [m + return IUP_DEFAULT;[m + }[m +[36m@@ -1883,59 +1635,136 @@[m [mstatic int motTreeCallBranchOpenCb(Ihandle* ih, Widget wItem)[m + {[m + IFni cbBranchOpen;[m + [m +[31m- if (iupAttribGet(ih, "_IUP_IGNORE_BRANCHOPEN"))[m +[31m- {[m +[31m- iupAttribSetStr(ih, "_IUP_IGNORE_BRANCHOPEN", NULL);[m +[32m+[m[32m if (iupAttribGet(ih, "_IUP_IGNORE_BRANCH_CB"))[m + return IUP_DEFAULT;[m +[31m- }[m + [m + cbBranchOpen = (IFni)IupGetCallback(ih, "BRANCHOPEN_CB");[m + if (cbBranchOpen)[m +[31m- return cbBranchOpen(ih, motTreeGetNodeId(ih, wItem));[m +[32m+[m[32m return cbBranchOpen(ih, iupTreeFindNodeId(ih, wItem));[m + [m + return IUP_DEFAULT;[m + }[m + [m +[32m+[m[32mstatic void motTreeFindRange(Ihandle* ih, WidgetList wSelectedItemList, int countItems, int *id1, int *id2)[m +[32m+[m[32m{[m +[32m+[m[32m int i = 0, id;[m +[32m+[m +[32m+[m[32m *id1 = ih->data->node_count;[m +[32m+[m[32m *id2 = -1;[m +[32m+[m +[32m+[m[32m for(i = 0; i < countItems; i++)[m +[32m+[m[32m {[m +[32m+[m[32m int is_icon = XmIsIconGadget(wSelectedItemList[i]); /* this line generates a warning in some compilers */[m +[32m+[m[32m if (is_icon)[m +[32m+[m[32m {[m +[32m+[m[32m id = iupTreeFindNodeId(ih, wSelectedItemList[i]);[m +[32m+[m[32m if (id < *id1)[m +[32m+[m[32m *id1 = id;[m +[32m+[m[32m if (id > *id2)[m +[32m+[m[32m *id2 = id;[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m /* interactive selection of several nodes will NOT select hidden nodes,[m +[32m+[m[32m so make sure that they are selected. */[m +[32m+[m[32m for(i = *id1; i <= *id2; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (!motTreeIsNodeSelected(ih->data->node_cache[i].node_handle))[m +[32m+[m[32m XtVaSetValues(ih->data->node_cache[i].node_handle, XmNvisualEmphasis, XmSELECTED, NULL);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m /* if last selected item is a branch, then select its children */[m +[32m+[m[32m iupTreeSelectLastCollapsedBranch(ih, id2);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic Iarray* motTreeGetSelectedArrayId(Ihandle* ih, WidgetList wSelectedItemList, int countItems)[m +[32m+[m[32m{[m +[32m+[m[32m Iarray* selarray = iupArrayCreate(1, sizeof(int));[m +[32m+[m[32m int i;[m +[32m+[m +[32m+[m[32m for(i = 0; i < countItems; i++)[m +[32m+[m[32m {[m +[32m+[m[32m int is_icon = XmIsIconGadget(wSelectedItemList[i]); /* this line generates a warning in some compilers */[m +[32m+[m[32m if (is_icon)[m +[32m+[m[32m {[m +[32m+[m[32m int* id_hitem = (int*)iupArrayInc(selarray);[m +[32m+[m[32m int j = iupArrayCount(selarray);[m +[32m+[m[32m id_hitem[j-1] = iupTreeFindNodeId(ih, wSelectedItemList[i]);[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m return selarray;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void motTreeCallMultiUnSelectionCb(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m IFnIi cbMulti = (IFnIi)IupGetCallback(ih, "MULTIUNSELECTION_CB");[m +[32m+[m[32m IFnii cbSelec = (IFnii)IupGetCallback(ih, "SELECTION_CB");[m +[32m+[m[32m if (cbSelec || cbMulti)[m +[32m+[m[32m {[m +[32m+[m[32m WidgetList wSelectedItemList = NULL;[m +[32m+[m[32m int countItems = 0;[m +[32m+[m +[32m+[m[32m XtVaGetValues(ih->handle, XmNselectedObjects, &wSelectedItemList,[m +[32m+[m[32m XmNselectedObjectCount, &countItems, NULL);[m +[32m+[m[32m if (countItems > 1)[m +[32m+[m[32m {[m +[32m+[m[32m Iarray* markedArray = motTreeGetSelectedArrayId(ih, wSelectedItemList, countItems);[m +[32m+[m[32m int* id_hitem = (int*)iupArrayGetData(markedArray);[m +[32m+[m[32m int i, count = iupArrayCount(markedArray);[m +[32m+[m +[32m+[m[32m if (cbMulti)[m +[32m+[m[32m cbMulti(ih, id_hitem, iupArrayCount(markedArray));[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m for (i=0; i<count; i++)[m +[32m+[m[32m cbSelec(ih, id_hitem[i], 0);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m iupArrayDestroy(markedArray);[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m + static void motTreeCallMultiSelectionCb(Ihandle* ih)[m + {[m + IFnIi cbMulti = (IFnIi)IupGetCallback(ih, "MULTISELECTION_CB");[m + IFnii cbSelec = (IFnii)IupGetCallback(ih, "SELECTION_CB");[m + WidgetList wSelectedItemList = NULL;[m +[31m- Widget wRoot;[m +[31m- int countItems;[m +[31m-[m +[31m- wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m +[32m+[m[32m int countItems, id1, id2, i;[m + [m + XtVaGetValues(ih->handle, XmNselectedObjects, &wSelectedItemList,[m + XmNselectedObjectCount, &countItems, NULL);[m + if (countItems == 0)[m + return;[m + [m +[31m- if (cbMulti || cbSelec)[m +[32m+[m[32m /* Must be a continuous range of selection ids */[m +[32m+[m[32m motTreeFindRange(ih, wSelectedItemList, countItems, &id1, &id2);[m +[32m+[m[32m countItems = id2-id1+1;[m +[32m+[m +[32m+[m[32m if (cbMulti)[m + {[m + int* id_rowItem = malloc(sizeof(int) * countItems);[m +[31m- int i = 0;[m + [m + for(i = 0; i < countItems; i++)[m +[31m- id_rowItem[i] = motTreeGetNodeId(ih, wSelectedItemList[i]);[m +[32m+[m[32m id_rowItem[i] = id1+i;[m + [m +[31m- if (cbMulti)[m +[31m- cbMulti(ih, id_rowItem, countItems);[m +[31m- else[m +[31m- {[m +[31m- for (i=0; i<countItems; i++)[m +[31m- cbSelec(ih, id_rowItem[i], 1);[m +[31m- }[m +[32m+[m[32m cbMulti(ih, id_rowItem, countItems);[m + [m + free(id_rowItem);[m + }[m +[32m+[m[32m else if (cbSelec)[m +[32m+[m[32m {[m +[32m+[m[32m for (i=0; i<countItems; i++)[m +[32m+[m[32m cbSelec(ih, id1+i, 1);[m +[32m+[m[32m }[m + }[m + [m + static int motTreeConvertXYToPos(Ihandle* ih, int x, int y)[m + {[m + Widget wItem = XmObjectAtPoint(ih->handle, (Position)x, (Position)y);[m + if (wItem)[m +[31m- return motTreeGetNodeId(ih, wItem);[m +[32m+[m[32m return iupTreeFindNodeId(ih, wItem);[m + return -1;[m + }[m + [m +[36m@@ -1965,7 +1794,7 @@[m [mstatic void motTreeCallRenameCb(Ihandle* ih)[m + cbRename = (IFnis)IupGetCallback(ih, "RENAME_CB");[m + if (cbRename)[m + {[m +[31m- if (cbRename(ih, motTreeGetNodeId(ih, wItem), title) == IUP_IGNORE)[m +[32m+[m[32m if (cbRename(ih, iupTreeFindNodeId(ih, wItem), title) == IUP_IGNORE)[m + ignore = 1;[m + }[m + [m +[36m@@ -1993,8 +1822,8 @@[m [mstatic int motTreeCallDragDropCb(Ihandle* ih, Widget wItemDrag, Widget wItemDrop[m + [m + if (cbDragDrop)[m + {[m +[31m- int drag_id = motTreeGetNodeId(ih, wItemDrag);[m +[31m- int drop_id = motTreeGetNodeId(ih, wItemDrop);[m +[32m+[m[32m int drag_id = iupTreeFindNodeId(ih, wItemDrag);[m +[32m+[m[32m int drop_id = iupTreeFindNodeId(ih, wItemDrop);[m + return cbDragDrop(ih, drag_id, drop_id, is_shift, *is_ctrl);[m + }[m + [m +[36m@@ -2069,6 +1898,10 @@[m [mstatic void motTreeShowEditField(Ihandle* ih, Widget wItem)[m + XmFontList fontlist;[m + Widget sb_win = (Widget)iupAttribGet(ih, "_IUP_EXTRAPARENT");[m + [m +[32m+[m[32m IFni cbShowRename = (IFni)IupGetCallback(ih, "SHOWRENAME_CB");[m +[32m+[m[32m if (cbShowRename && cbShowRename(ih, iupTreeFindNodeId(ih, wItem))==IUP_IGNORE)[m +[32m+[m[32m return;[m +[32m+[m + XtVaGetValues(wItem, XmNx, &x, [m + XmNy, &y,[m + XmNwidth, &w, [m +[36m@@ -2083,16 +1916,16 @@[m [mstatic void motTreeShowEditField(Ihandle* ih, Widget wItem)[m + iupdrvImageGetInfo((void*)image, &w_img, NULL, NULL);[m + w_img += 3; /* add some room for borders */[m + [m +[31m- iupmotSetArg(args, num_args, XmNx, x+w_img); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, y); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, w-w_img); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, h); /* default height to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, ih->data->spacing); /* default padding */[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNforeground, color);[m +[31m- iupmotSetArg(args, num_args, XmNrenderTable, fontlist);[m +[31m- iupmotSetArg(args, num_args, XmNvalue, iupmotConvertString(title));[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, x+w_img); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, y); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, w-w_img); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, h); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, ih->data->spacing); /* default padding */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNforeground, color);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNrenderTable, fontlist);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNvalue, iupmotConvertString(title));[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m + [m + cbEdit = XtCreateManagedWidget([m + child_id, /* child identifier */[m +[36m@@ -2134,8 +1967,6 @@[m [mstatic void motTreeSelectionCallback(Widget w, Ihandle* ih, XmContainerSelectCal[m + (void)w;[m + (void)nptr;[m + [m +[31m-printf("SelectionCallback(%d)\n", nptr->selected_item_count);[m +[31m-[m + if (ih->data->mark_mode == ITREE_MARK_MULTIPLE)[m + {[m + char key[5];[m +[36m@@ -2149,11 +1980,13 @@[m [mprintf("SelectionCallback(%d)\n", nptr->selected_item_count);[m + {[m + if (IupGetCallback(ih, "MULTISELECTION_CB"))[m + {[m +[32m+[m[32m /* current selection same as the initial selection */[m + if (nptr->auto_selection_type==XmAUTO_NO_CHANGE)[m + motTreeCallMultiSelectionCb(ih);[m + }[m + else[m + {[m +[32m+[m[32m /* current selection is caused by button drag */[m + if (nptr->auto_selection_type==XmAUTO_MOTION)[m + motTreeCallMultiSelectionCb(ih);[m + }[m +[36m@@ -2164,14 +1997,10 @@[m [mprintf("SelectionCallback(%d)\n", nptr->selected_item_count);[m + cbSelec = (IFnii)IupGetCallback(ih, "SELECTION_CB");[m + if (cbSelec)[m + {[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[31m- int curpos = motTreeGetNodeId(ih, wItemFocus);[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m +[32m+[m[32m int curpos = iupTreeFindNodeId(ih, wItemFocus);[m + if (is_ctrl) [m +[31m- {[m +[31m- unsigned char isSelected;[m +[31m- XtVaGetValues(wItemFocus, XmNvisualEmphasis, &isSelected, NULL);[m +[31m- cbSelec(ih, curpos, isSelected == XmSELECTED? 1: 0);[m +[31m- }[m +[32m+[m[32m cbSelec(ih, curpos, motTreeIsNodeSelected(wItemFocus));[m + else[m + {[m + int oldpos = iupAttribGetInt(ih, "_IUPTREE_OLDVALUE");[m +[36m@@ -2218,7 +2047,7 @@[m [mstatic void motTreeDefaultActionCallback(Widget w, Ihandle* ih, XmContainerSelec[m + {[m + IFni cbExecuteLeaf = (IFni)IupGetCallback(ih, "EXECUTELEAF_CB");[m + if (cbExecuteLeaf)[m +[31m- cbExecuteLeaf(ih, motTreeGetNodeId(ih, wItem));[m +[32m+[m[32m cbExecuteLeaf(ih, iupTreeFindNodeId(ih, wItem));[m + }[m + }[m + [m +[36m@@ -2295,15 +2124,14 @@[m [mstatic void motTreeKeyPressEvent(Widget w, Ihandle *ih, XKeyEvent *evt, Boolean[m + iupmotHelpCallback(w, ih, NULL);[m + else if ((motcode == XK_Down || motcode == XK_Up) && (evt->state & ControlMask))[m + {[m +[31m- Widget wRoot = (Widget)iupAttribGet(ih, "_IUPTREE_ROOTITEM");[m + Widget wItem;[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m + [m + /* Ctrl+Arrows move only focus */[m + if (motcode == XK_Down)[m +[31m- wItem = motTreeGetNextVisibleNode(ih, wRoot, wItemFocus);[m +[32m+[m[32m wItem = motTreeGetNextVisibleNode(ih, wItemFocus, 1);[m + else[m +[31m- wItem = motTreeGetPreviousVisibleNode(ih, wRoot, wItemFocus);[m +[32m+[m[32m wItem = motTreeGetPreviousVisibleNode(ih, wItemFocus, 1);[m + [m + motTreeSetFocusNode(ih, wItem);[m + *cont = False;[m +[36m@@ -2317,8 +2145,8 @@[m [mstatic void motTreeKeyPressEvent(Widget w, Ihandle *ih, XKeyEvent *evt, Boolean[m + [m + if (motcode == XK_Home)[m + wItem = wRoot;[m +[31m- else[m +[31m- wItem = motTreeGetLastVisibleNode(ih, wRoot);[m +[32m+[m[32m else /* motcode == XK_End */[m +[32m+[m[32m wItem = motTreeGetLastVisibleNode(ih);[m + [m + /* Ctrl+Arrows move only focus */[m + if (!(evt->state & ControlMask))[m +[36m@@ -2326,7 +2154,7 @@[m [mstatic void motTreeKeyPressEvent(Widget w, Ihandle *ih, XKeyEvent *evt, Boolean[m + /* Shift+Arrows select block */[m + if (evt->state & ShiftMask)[m + {[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m + if (!wItemFocus)[m + return;[m + motTreeSelectRange(ih, wItemFocus, wItem, 1);[m +[36m@@ -2346,16 +2174,9 @@[m [mstatic void motTreeKeyPressEvent(Widget w, Ihandle *ih, XKeyEvent *evt, Boolean[m + }[m + else if(motcode == XK_space && (evt->state & ControlMask))[m + {[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m + if (wItemFocus)[m +[31m- {[m +[31m- unsigned char isSelected;[m +[31m- XtVaGetValues(wItemFocus, XmNvisualEmphasis, &isSelected, NULL);[m +[31m- if (isSelected == XmSELECTED)[m +[31m- XtVaSetValues(wItemFocus, XmNvisualEmphasis, XmNOT_SELECTED, NULL);[m +[31m- else[m +[31m- XtVaSetValues(wItemFocus, XmNvisualEmphasis, XmSELECTED, NULL);[m +[31m- }[m +[32m+[m[32m motTreeSelectNode(wItemFocus, -1);[m + }[m + }[m + [m +[36m@@ -2378,7 +2199,7 @@[m [mstatic void motTreeButtonEvent(Widget w, Ihandle* ih, XButtonEvent* evt, Boolean[m + [m + if (evt->button==Button1)[m + {[m +[31m- Widget wItemFocus = motTreeGetFocusNode(ih);[m +[32m+[m[32m Widget wItemFocus = iupdrvTreeGetFocusNode(ih);[m + static Widget wLastItem = NULL;[m + static Time last = 0;[m + int clicktwice = 0, doubleclicktime = XtGetMultiClickTime(iupmot_display);[m +[36m@@ -2395,6 +2216,11 @@[m [mstatic void motTreeButtonEvent(Widget w, Ihandle* ih, XButtonEvent* evt, Boolean[m + *cont = False;[m + }[m + wLastItem = wItemFocus;[m +[32m+[m +[32m+[m[32m if (ih->data->mark_mode==ITREE_MARK_MULTIPLE &&[m[41m [m +[32m+[m[32m !(evt->state & ShiftMask) &&[m +[32m+[m[32m !(evt->state & ControlMask))[m +[32m+[m[32m motTreeCallMultiUnSelectionCb(ih);[m + }[m + else if (evt->button==Button3)[m + motTreeCallRightClickCb(ih, evt->x, evt->y);[m +[36m@@ -2436,21 +2262,18 @@[m [mstatic void motTreeTransferProc(Widget drop_context, XtPointer client_data, Atom[m + [m + if (motTreeCallDragDropCb(ih, wItemDrag, wItemDrop, &is_ctrl) == IUP_CONTINUE)[m + {[m +[31m- /* Copy the dragged item to the new position. */[m +[31m- Widget wNewItem = motTreeCopyNode(ih, wItemDrag, wItemDrop, is_ctrl);[m +[32m+[m[32m /* Copy or move the dragged item to the new position. */[m +[32m+[m[32m Widget wItemNew = motTreeCopyMoveNode(ih, wItemDrag, wItemDrop, is_ctrl);[m + [m +[31m- if (!is_ctrl)[m +[32m+[m[32m /* Set focus and selection */[m +[32m+[m[32m if (wItemNew)[m + {[m +[31m- /* do not delete the user data, we copy the references in CopyNode */[m +[31m- motTreeRemoveNode(ih, wItemDrag, 0);[m +[31m- }[m +[31m-[m +[31m- /* Select the dragged item */[m +[31m- XtVaSetValues(ih->handle, XmNselectedObjects, NULL, NULL);[m +[31m- XtVaSetValues(ih->handle, XmNselectedObjectCount, 0, NULL);[m +[31m- XtVaSetValues(wNewItem, XmNvisualEmphasis, XmSELECTED, NULL);[m +[32m+[m[32m XtVaSetValues(ih->handle, XmNselectedObjects, NULL, NULL);[m +[32m+[m[32m XtVaSetValues(ih->handle, XmNselectedObjectCount, 0, NULL);[m +[32m+[m[32m XtVaSetValues(wItemNew, XmNvisualEmphasis, XmSELECTED, NULL);[m + [m +[31m- motTreeSetFocusNode(ih, wNewItem);[m +[32m+[m[32m motTreeSetFocusNode(ih, wItemNew);[m +[32m+[m[32m }[m + }[m + }[m + [m +[36m@@ -2475,8 +2298,8 @@[m [mstatic void motTreeDropProc(Widget w, XtPointer client_data, XmDropProcCallbackS[m + drop_context = drop_data->dragContext;[m + [m + /* retrieve the data targets */[m +[31m- iupmotSetArg(args, num_args, XmNexportTargets, &exportTargets);[m +[31m- iupmotSetArg(args, num_args, XmNnumExportTargets, &numExportTargets);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNexportTargets, &exportTargets);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnumExportTargets, &numExportTargets);[m + XtGetValues(drop_context, args, num_args);[m + [m + for (i = 0; i < (int)numExportTargets; i++) [m +[36m@@ -2495,17 +2318,17 @@[m [mstatic void motTreeDropProc(Widget w, XtPointer client_data, XmDropProcCallbackS[m + num_args = 0;[m + if ((!found) || (drop_data->dropAction != XmDROP) || (drop_data->operation != XmDROP_COPY && drop_data->operation != XmDROP_MOVE)) [m + {[m +[31m- iupmotSetArg(args, num_args, XmNtransferStatus, XmTRANSFER_FAILURE);[m +[31m- iupmotSetArg(args, num_args, XmNnumDropTransfers, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtransferStatus, XmTRANSFER_FAILURE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnumDropTransfers, 0);[m + }[m + else [m + {[m + /* set up transfer requests for drop site */[m + transferList[0].target = atomTreeItem;[m + transferList[0].client_data = (XtPointer)wItemDrop;[m +[31m- iupmotSetArg(args, num_args, XmNdropTransfers, transferList);[m +[31m- iupmotSetArg(args, num_args, XmNnumDropTransfers, 1);[m +[31m- iupmotSetArg(args, num_args, XmNtransferProc, motTreeTransferProc);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNdropTransfers, transferList);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnumDropTransfers, 1);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtransferProc, motTreeTransferProc);[m + }[m + [m + XmDropTransferStart(drop_context, args, num_args);[m +[36m@@ -2584,23 +2407,23 @@[m [mstatic void motTreeStartDrag(Widget w, XButtonEvent* evt, String* params, Cardin[m + XmNforeground, &fg,[m + NULL);[m + [m +[31m- iupmotSetArg(args, num_args, XmNpixmap, pixmap);[m +[31m- iupmotSetArg(args, num_args, XmNmask, mask);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNpixmap, pixmap);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmask, mask);[m + drag_icon = XmCreateDragIcon(w, "drag_icon", args, num_args);[m + [m + exportList[0] = atomTreeItem;[m + [m + /* specify resources for DragContext for the transfer */[m + num_args = 0;[m +[31m- iupmotSetArg(args, num_args, XmNcursorBackground, bg);[m +[31m- iupmotSetArg(args, num_args, XmNcursorForeground, fg);[m +[31m- /* iupmotSetArg(args, num_args, XmNsourcePixmapIcon, drag_icon); works, but only outside the dialog, inside disapears */[m +[31m- iupmotSetArg(args, num_args, XmNsourceCursorIcon, drag_icon); /* does not work, shows the default cursor */[m +[31m- iupmotSetArg(args, num_args, XmNexportTargets, exportList);[m +[31m- iupmotSetArg(args, num_args, XmNnumExportTargets, 1);[m +[31m- iupmotSetArg(args, num_args, XmNdragOperations, XmDROP_MOVE|XmDROP_COPY);[m +[31m- iupmotSetArg(args, num_args, XmNconvertProc, motTreeConvertProc);[m +[31m- iupmotSetArg(args, num_args, XmNclientData, wItemDrag);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNcursorBackground, bg);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNcursorForeground, fg);[m +[32m+[m[32m /* iupMOT_SETARG(args, num_args, XmNsourcePixmapIcon, drag_icon); works, but only outside the dialog, inside disapears */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsourceCursorIcon, drag_icon); /* does not work, shows the default cursor */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNexportTargets, exportList);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnumExportTargets, 1);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNdragOperations, XmDROP_MOVE|XmDROP_COPY);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNconvertProc, motTreeConvertProc);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNclientData, wItemDrag);[m + [m + /* start the drag and register a callback to clean up when done */[m + drop_context = XmDragStart(w, (XEvent*)evt, args, num_args);[m +[36m@@ -2628,10 +2451,10 @@[m [mstatic void motTreeEnableDragDrop(Widget w)[m + XtOverrideTranslations(w, XtParseTranslationTable(dragTranslations));[m + [m + importList[0] = atomTreeItem;[m +[31m- iupmotSetArg(args, num_args, XmNimportTargets, importList);[m +[31m- iupmotSetArg(args, num_args, XmNnumImportTargets, 1);[m +[31m- iupmotSetArg(args, num_args, XmNdropSiteOperations, XmDROP_MOVE|XmDROP_COPY);[m +[31m- iupmotSetArg(args, num_args, XmNdropProc, motTreeDropProc);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNimportTargets, importList);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnumImportTargets, 1);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNdropSiteOperations, XmDROP_MOVE|XmDROP_COPY);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNdropProc, motTreeDropProc);[m + XmDropSiteUpdate(w, args, num_args);[m + [m + XtVaSetValues(XmGetXmDisplay(iupmot_display), XmNenableDragIcon, True, NULL);[m +[36m@@ -2648,13 +2471,13 @@[m [mstatic int motTreeMapMethod(Ihandle* ih)[m + /******************************/[m + /* Create the scrolled window */[m + /******************************/[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNscrollingPolicy, XmAUTOMATIC);[m +[31m- iupmotSetArg(args, num_args, XmNvisualPolicy, XmVARIABLE); [m +[31m- iupmotSetArg(args, num_args, XmNscrollBarDisplayPolicy, XmAS_NEEDED);[m +[31m- iupmotSetArg(args, num_args, XmNspacing, 0); /* no space between scrollbars and text */[m +[31m- iupmotSetArg(args, num_args, XmNborderWidth, 0);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollingPolicy, XmAUTOMATIC);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNvisualPolicy, XmVARIABLE);[m[41m [m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNscrollBarDisplayPolicy, XmAS_NEEDED);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNspacing, 0); /* no space between scrollbars and text */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNborderWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 2);[m + [m + sb_win = XtCreateManagedWidget([m + child_id, /* child identifier */[m +[36m@@ -2672,37 +2495,37 @@[m [mstatic int motTreeMapMethod(Ihandle* ih)[m + [m + num_args = 0;[m + [m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + [m +[31m- iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[31m- iupmotSetArg(args, num_args, XmNmarginWidth, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* default padding */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmarginWidth, 0);[m + [m + if (iupAttribGetBoolean(ih, "CANFOCUS"))[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m + [m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 2);[m +[31m- iupmotSetArg(args, num_args, XmNshadowThickness, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshadowThickness, 0);[m + [m +[31m- iupmotSetArg(args, num_args, XmNlayoutType, XmOUTLINE);[m +[31m- iupmotSetArg(args, num_args, XmNentryViewType, XmSMALL_ICON);[m +[31m- iupmotSetArg(args, num_args, XmNselectionPolicy, XmSINGLE_SELECT);[m +[31m- iupmotSetArg(args, num_args, XmNoutlineIndentation, 20);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNlayoutType, XmOUTLINE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNentryViewType, XmSMALL_ICON);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNselectionPolicy, XmSINGLE_SELECT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNoutlineIndentation, 20);[m + [m + if (iupAttribGetBoolean(ih, "HIDELINES"))[m +[31m- iupmotSetArg(args, num_args, XmNoutlineLineStyle, XmNO_LINE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNoutlineLineStyle, XmNO_LINE);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNoutlineLineStyle, XmSINGLE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNoutlineLineStyle, XmSINGLE);[m + [m + if (iupAttribGetBoolean(ih, "HIDEBUTTONS"))[m +[31m- iupmotSetArg(args, num_args, XmNoutlineButtonPolicy, XmOUTLINE_BUTTON_ABSENT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNoutlineButtonPolicy, XmOUTLINE_BUTTON_ABSENT);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNoutlineButtonPolicy, XmOUTLINE_BUTTON_PRESENT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNoutlineButtonPolicy, XmOUTLINE_BUTTON_PRESENT);[m + [m + ih->handle = XtCreateManagedWidget([m + child_id, /* child identifier */[m +[36m@@ -2788,17 +2611,30 @@[m [mstatic int motTreeMapMethod(Ihandle* ih)[m + if (!ih->data->def_image_expanded_mask) ih->data->def_image_expanded_mask = (void*)XmUNSPECIFIED_PIXMAP;[m + }[m + [m +[31m- motTreeAddRootNode(ih);[m +[32m+[m[32m if (iupAttribGetInt(ih, "ADDROOT"))[m +[32m+[m[32m iupdrvTreeAddNode(ih, "-1", ITREE_BRANCH, "", 0);[m + [m + IupSetCallback(ih, "_IUP_XY2POS_CB", (Icallback)motTreeConvertXYToPos);[m + [m +[32m+[m[32m iupdrvTreeUpdateMarkMode(ih);[m +[32m+[m + return IUP_NOERROR;[m + }[m + [m +[32m+[m[32mstatic void motTreeUnMapMethod(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m motTreeRemoveAllNodes(ih, 0);[m +[32m+[m +[32m+[m[32m ih->data->node_count = 0;[m +[32m+[m +[32m+[m[32m iupdrvBaseUnMapMethod(ih);[m +[32m+[m[32m}[m +[32m+[m + void iupdrvTreeInitClass(Iclass* ic)[m + {[m + /* Driver Dependent Class functions */[m + ic->Map = motTreeMapMethod;[m +[32m+[m[32m ic->UnMap = motTreeUnMapMethod;[m + [m + /* Visual */[m + iupClassRegisterAttribute(ic, "BGCOLOR", NULL, motTreeSetBgColorAttrib, "TXTBGCOLOR", NULL, IUPAF_DEFAULT);[m +[36m@@ -2807,7 +2643,6 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + /* IupTree Attributes - GENERAL */[m + iupClassRegisterAttribute(ic, "EXPANDALL", NULL, motTreeSetExpandAllAttrib, NULL, NULL, IUPAF_WRITEONLY||IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "INDENTATION", motTreeGetIndentationAttrib, motTreeSetIndentationAttrib, NULL, NULL, IUPAF_DEFAULT);[m +[31m- iupClassRegisterAttribute(ic, "COUNT", motTreeGetCountAttrib, NULL, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_READONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "SPACING", iupTreeGetSpacingAttrib, motTreeSetSpacingAttrib, NULL, NULL, IUPAF_NOT_MAPPED);[m + iupClassRegisterAttribute(ic, "TOPITEM", NULL, motTreeSetTopItemAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + [m +[36m@@ -2827,7 +2662,6 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + iupClassRegisterAttributeId(ic, "COLOR", motTreeGetColorAttrib, motTreeSetColorAttrib, IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "NAME", motTreeGetTitleAttrib, motTreeSetTitleAttrib, IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TITLE", motTreeGetTitleAttrib, motTreeSetTitleAttrib, IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttributeId(ic, "USERDATA", motTreeGetUserDataAttrib, motTreeSetUserDataAttrib, IUPAF_NO_STRING|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "CHILDCOUNT", motTreeGetChildCountAttrib, NULL, IUPAF_READONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TITLEFONT", motTreeGetTitleFontAttrib, motTreeSetTitleFontAttrib, IUPAF_NO_INHERIT);[m + [m +[36m@@ -2836,6 +2670,7 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + iupClassRegisterAttribute (ic, "MARK", NULL, motTreeSetMarkAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute (ic, "STARTING", NULL, motTreeSetMarkStartAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute (ic, "MARKSTART", NULL, motTreeSetMarkStartAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute (ic, "MARKEDNODES", motTreeGetMarkedNodesAttrib, motTreeSetMarkedNodesAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + [m + iupClassRegisterAttribute (ic, "VALUE", motTreeGetValueAttrib, motTreeSetValueAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + [m +[36m@@ -2844,5 +2679,4 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "RENAME", NULL, motTreeSetRenameAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "MOVENODE", NULL, motTreeSetMoveNodeAttrib, IUPAF_NOT_MAPPED|IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "COPYNODE", NULL, motTreeSetCopyNodeAttrib, IUPAF_NOT_MAPPED|IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttributeId(ic, "FINDUSERDATA", motTreeGetFindUserDataAttrib, NULL, IUPAF_READONLY|IUPAF_NO_INHERIT);[m + }[m +[1mdiff --git a/iup/src/mot/iupmot_val.c b/iup/src/mot/iupmot_val.c[m +[1mindex 200d2b4..ce9eba7 100755[m +[1m--- a/iup/src/mot/iupmot_val.c[m +[1m+++ b/iup/src/mot/iupmot_val.c[m +[36m@@ -383,41 +383,41 @@[m [mstatic int motValMapMethod(Ihandle* ih)[m + int show_ticks;[m + [m + /* Core */[m +[31m- iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[31m- iupmotSetArg(args, num_args, XmNx, 0); /* x-position */[m +[31m- iupmotSetArg(args, num_args, XmNy, 0); /* y-position */[m +[31m- iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[31m- iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */[m + /* Primitive */[m + if (iupAttribGetBoolean(ih, "CANFOCUS"))[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, True);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, True);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNtraversalOn, False);[m +[31m- iupmotSetArg(args, num_args, XmNhighlightThickness, 2);[m +[31m- iupmotSetArg(args, num_args, XmNnavigationType, XmTAB_GROUP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNtraversalOn, False);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNhighlightThickness, 2);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNnavigationType, XmTAB_GROUP);[m + /* Scale */[m +[31m- iupmotSetArg(args, num_args, XmNminimum, 0);[m +[31m- iupmotSetArg(args, num_args, XmNmaximum, SHRT_MAX);[m +[31m- iupmotSetArg(args, num_args, XmNslidingMode, XmSLIDER);[m +[31m- iupmotSetArg(args, num_args, XmNsliderMark, XmETCHED_LINE);[m +[31m- iupmotSetArg(args, num_args, XmNsliderSize, 16);[m +[31m- iupmotSetArg(args, num_args, XmNshowValue, XmNONE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNminimum, 0);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNmaximum, SHRT_MAX);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNslidingMode, XmSLIDER);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsliderMark, XmETCHED_LINE);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNsliderSize, 16);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNshowValue, XmNONE);[m + [m + if (ih->data->type == IVAL_HORIZONTAL)[m + {[m +[31m- iupmotSetArg(args, num_args, XmNorientation, XmHORIZONTAL);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNorientation, XmHORIZONTAL);[m + if (ih->data->inverted)[m +[31m- iupmotSetArg(args, num_args, XmNprocessingDirection, XmMAX_ON_LEFT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNprocessingDirection, XmMAX_ON_LEFT);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNprocessingDirection, XmMAX_ON_RIGHT);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNprocessingDirection, XmMAX_ON_RIGHT);[m + }[m + else[m + {[m +[31m- iupmotSetArg(args, num_args, XmNorientation, XmVERTICAL);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNorientation, XmVERTICAL);[m + if (ih->data->inverted)[m +[31m- iupmotSetArg(args, num_args, XmNprocessingDirection, XmMAX_ON_TOP);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNprocessingDirection, XmMAX_ON_TOP);[m + else[m +[31m- iupmotSetArg(args, num_args, XmNprocessingDirection, XmMAX_ON_BOTTOM);[m +[32m+[m[32m iupMOT_SETARG(args, num_args, XmNprocessingDirection, XmMAX_ON_BOTTOM);[m + }[m + [m + ih->handle = XtCreateManagedWidget([m +[1mdiff --git a/iup/src/mot/iupunix_info.c b/iup/src/mot/iupunix_info.c[m +[1mindex b522638..f09573c 100755[m +[1m--- a/iup/src/mot/iupunix_info.c[m +[1m+++ b/iup/src/mot/iupunix_info.c[m +[36m@@ -282,7 +282,7 @@[m [mchar *iupdrvGetSystemName(void)[m + char *iupdrvGetSystemVersion(void)[m + {[m + struct utsname un;[m +[31m- char *str = iupStrGetMemory(60); [m +[32m+[m[32m char *str = iupStrGetMemory(100);[m[41m [m + [m + uname(&un);[m + strcpy(str, un.release);[m +[1mdiff --git a/iup/src/win/iupwin_button.c b/iup/src/win/iupwin_button.c[m +[1mindex 7f780e3..3b05ba7 100755[m +[1m--- a/iup/src/win/iupwin_button.c[m +[1m+++ b/iup/src/win/iupwin_button.c[m +[36m@@ -27,6 +27,7 @@[m + #include "iupwin_drv.h"[m + #include "iupwin_handle.h"[m + #include "iupwin_draw.h"[m +[32m+[m[32m#include "iupwin_info.h"[m + [m + [m + #ifndef CDIS_SHOWKEYBOARDCUES[m +[36m@@ -308,18 +309,22 @@[m [mstatic void winButtonDrawText(Ihandle* ih, HDC hDC, int rect_width, int rect_hei[m + [m + static void winButtonDrawItem(Ihandle* ih, DRAWITEMSTRUCT *drawitem)[m + { [m +[32m+[m[32m HDC hDC;[m + iupwinBitmapDC bmpDC;[m + int border, draw_border;[m + int width = drawitem->rcItem.right - drawitem->rcItem.left;[m + int height = drawitem->rcItem.bottom - drawitem->rcItem.top;[m + [m +[31m- HDC hDC = iupwinDrawCreateBitmapDC(&bmpDC, drawitem->hDC, width, height);[m +[32m+[m[32m hDC = iupwinDrawCreateBitmapDC(&bmpDC, drawitem->hDC, width, height);[m + [m + iupwinDrawParentBackground(ih, hDC, &drawitem->rcItem);[m + [m + if ((drawitem->itemState & ODS_FOCUS) && !(drawitem->itemState & ODS_HOTLIGHT))[m + drawitem->itemState |= ODS_DEFAULT;[m + [m +[32m+[m[32m if (iupAttribGet(ih, "_IUPWINBUT_SELECTED"))[m +[32m+[m[32m drawitem->itemState |= ODS_SELECTED;[m +[32m+[m + border = winButtonGetBorder();[m + [m + if (ih->data->type & IUP_BUTTON_IMAGE && iupAttribGet(ih, "IMPRESS") && !iupAttribGetStr(ih, "IMPRESSBORDER"))[m +[36m@@ -365,7 +370,7 @@[m [mstatic int winButtonSetImageAttrib(Ihandle* ih, const char* value)[m + (void)value;[m + if (ih->data->type != IUP_BUTTON_TEXT)[m + {[m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + return 1;[m + }[m + else[m +[36m@@ -377,7 +382,7 @@[m [mstatic int winButtonSetImInactiveAttrib(Ihandle* ih, const char* value)[m + (void)value;[m + if (ih->data->type != IUP_BUTTON_TEXT)[m + {[m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + return 1;[m + }[m + else[m +[36m@@ -389,7 +394,7 @@[m [mstatic int winButtonSetImPressAttrib(Ihandle* ih, const char* value)[m + (void)value;[m + if (ih->data->type != IUP_BUTTON_TEXT)[m + {[m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + return 1;[m + }[m + else[m +[36m@@ -400,7 +405,7 @@[m [mstatic int winButtonSetActiveAttrib(Ihandle* ih, const char* value)[m + {[m + /* redraw IMINACTIVE image if any */[m + if (ih->data->type != IUP_BUTTON_TEXT)[m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + [m + return iupBaseSetActiveAttrib(ih, value);[m + }[m +[36m@@ -425,7 +430,7 @@[m [mstatic int winButtonSetAlignmentAttrib(Ihandle* ih, const char* value)[m + else /* "ACENTER" */[m + ih->data->vert_alignment = IUP_ALIGN_ACENTER;[m + [m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + [m + return 1;[m + }[m +[36m@@ -443,7 +448,7 @@[m [mstatic int winButtonSetPaddingAttrib(Ihandle* ih, const char* value)[m + {[m + iupStrToIntInt(value, &ih->data->horiz_padding, &ih->data->vert_padding, 'x');[m + if (ih->handle)[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + return 0;[m + }[m + [m +[36m@@ -454,7 +459,7 @@[m [mstatic int winButtonSetBgColorAttrib(Ihandle* ih, const char* value)[m + {[m + iupAttribSetStr(ih, "BGCOLOR", value);[m + iupImageUpdateParent(ih);[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + return 1;[m + }[m +[36m@@ -486,7 +491,9 @@[m [mstatic int winButtonSetFgColorAttrib(Ihandle* ih, const char* value)[m + if (iupStrToRGB(value, &r, &g, &b))[m + {[m + ih->data->fgcolor = RGB(r,g,b);[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m +[32m+[m[32m if (ih->handle)[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + return 1;[m + }[m +[36m@@ -499,7 +506,7 @@[m [mstatic int winButtonProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r[m + {[m + /* redraw IMPRESS image if any */[m + if ((msg == WM_LBUTTONDOWN || msg == WM_LBUTTONUP) && iupAttribGet(ih, "IMPRESS"))[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + [m + switch (msg)[m +[36m@@ -514,6 +521,13 @@[m [mstatic int winButtonProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r[m + case WM_RBUTTONDOWN:[m + {[m + iupwinButtonDown(ih, msg, wp, lp);[m +[32m+[m +[32m+[m[32m /* Feedback will NOT be done when not receiving the focus */[m +[32m+[m[32m if (msg==WM_LBUTTONDOWN && !iupAttribGetBoolean(ih, "FOCUSONCLICK"))[m +[32m+[m[32m {[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPWINBUT_SELECTED", "1");[m +[32m+[m[32m iupdrvRedrawNow(ih);[m +[32m+[m[32m }[m + break;[m + }[m + case WM_XBUTTONUP:[m +[36m@@ -526,11 +540,24 @@[m [mstatic int winButtonProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r[m + /* BN_CLICKED will NOT be notified when not receiving the focus */[m + if (msg==WM_LBUTTONUP && !iupAttribGetBoolean(ih, "FOCUSONCLICK"))[m + {[m +[31m- Icallback cb = IupGetCallback(ih, "ACTION");[m +[32m+[m[32m Icallback cb;[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPWINBUT_SELECTED", NULL);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m +[32m+[m +[32m+[m[32m cb = IupGetCallback(ih, "ACTION");[m + if (cb && cb(ih) == IUP_CLOSE)[m + IupExitLoop();[m + }[m + [m +[32m+[m[32m if (!iupwinIsVistaOrNew())[m +[32m+[m[32m {[m +[32m+[m[32m /* TIPs desapear forever after a button click in XP,[m +[32m+[m[32m so we force an update. */[m +[32m+[m[32m char* tip = iupAttribGet(ih, "TIP");[m +[32m+[m[32m if (tip)[m +[32m+[m[32m iupdrvBaseSetTipAttrib(ih, tip);[m +[32m+[m[32m }[m + break;[m + }[m + case WM_KEYDOWN:[m +[36m@@ -549,7 +576,12 @@[m [mstatic int winButtonProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r[m + if (!iupwin_comctl32ver6)[m + {[m + iupAttribSetStr(ih, "_IUPWINBUT_ENTERWIN", NULL);[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m +[32m+[m[32m }[m +[32m+[m[32m if (!iupAttribGetBoolean(ih, "FOCUSONCLICK"))[m +[32m+[m[32m {[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPWINBUT_SELECTED", NULL);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + break;[m + case WM_MOUSEMOVE:[m +[36m@@ -558,7 +590,7 @@[m [mstatic int winButtonProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r[m + if (!iupAttribGet(ih, "_IUPWINBUT_ENTERWIN"))[m + {[m + iupAttribSetStr(ih, "_IUPWINBUT_ENTERWIN", "1");[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + }[m + break;[m +[36m@@ -635,7 +667,7 @@[m [mstatic int winButtonWmCommand(Ihandle* ih, WPARAM wp, LPARAM lp)[m + static int winButtonMapMethod(Ihandle* ih)[m + {[m + char* value;[m +[31m- DWORD dwStyle = WS_CHILD | [m +[32m+[m[32m DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS |[m + BS_NOTIFY; /* necessary because of the base messages */[m + [m + if (!ih->parent)[m +[36m@@ -661,7 +693,7 @@[m [mstatic int winButtonMapMethod(Ihandle* ih)[m + ih->data->type = IUP_BUTTON_IMAGE;[m + [m + value = iupAttribGet(ih, "TITLE");[m +[31m- if (value)[m +[32m+[m[32m if (value && *value!=0)[m + ih->data->type |= IUP_BUTTON_TEXT;[m + }[m + else[m +[1mdiff --git a/iup/src/win/iupwin_canvas.c b/iup/src/win/iupwin_canvas.c[m +[1mindex bb88b8a..b865160 100755[m +[1m--- a/iup/src/win/iupwin_canvas.c[m +[1m+++ b/iup/src/win/iupwin_canvas.c[m +[36m@@ -45,7 +45,7 @@[m [mstatic void winCanvasSetScrollInfo(HWND hWnd, int imin, int imax, int ipos, int[m + static int winCanvasSetBgColorAttrib(Ihandle *ih, const char *value)[m + {[m + (void)value;[m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + return 1;[m + }[m + [m +[36m@@ -220,7 +220,7 @@[m [mstatic void winCanvasUpdateHorScroll(Ihandle* ih, WORD winop)[m + xmax = iupAttribGetFloat(ih,"XMAX");[m + xmin = iupAttribGetFloat(ih,"XMIN");[m + [m +[31m- winCanvasGetScrollInfo(ih->handle, &iposx, &ipagex, SB_HORZ, winop==SB_THUMBTRACK? 1: 0);[m +[32m+[m[32m winCanvasGetScrollInfo(ih->handle, &iposx, &ipagex, SB_HORZ, winop==SB_THUMBTRACK||winop==SB_THUMBPOSITION? 1: 0);[m + [m + if (!iupAttribGet(ih,"LINEX"))[m + {[m +[36m@@ -296,7 +296,7 @@[m [mstatic void winCanvasUpdateVerScroll(Ihandle* ih, WORD winop)[m + ymax = iupAttribGetFloat(ih,"YMAX");[m + ymin = iupAttribGetFloat(ih,"YMIN");[m + [m +[31m- winCanvasGetScrollInfo(ih->handle, &iposy, &ipagey, SB_VERT, winop==SB_THUMBTRACK? 1: 0);[m +[32m+[m[32m winCanvasGetScrollInfo(ih->handle, &iposy, &ipagey, SB_VERT, winop==SB_THUMBTRACK||winop==SB_THUMBPOSITION? 1: 0);[m + [m + if (!iupAttribGet(ih, "LINEY"))[m + {[m +[36m@@ -372,6 +372,10 @@[m [mstatic int winCanvasProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r[m + GetClientRect(ih->handle, &rect); [m + FillRect(hdc, &rect, iupwinBrushGet(color)); [m + }[m +[32m+[m[32m else[m +[32m+[m[32m InvalidateRect(ih->handle,NULL,FALSE); /* This will invalidate all area.[m[41m [m +[32m+[m[32m Necessary in XP, or overlapping windows will have the effect of partial redrawing. */[m +[32m+[m + /* always return non zero value */[m + *result = 1;[m + return 1; [m +[36m@@ -382,7 +386,7 @@[m [mstatic int winCanvasProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r[m + {[m + PAINTSTRUCT ps;[m + HDC hdc = BeginPaint(ih->handle, &ps);[m +[31m- iupAttribSetStr(ih, "HDC_WMPAINT", (char*)&hdc);[m +[32m+[m[32m iupAttribSetStr(ih, "HDC_WMPAINT", (char*)hdc);[m + iupAttribSetStrf(ih, "CLIPRECT", "%d %d %d %d", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right-ps.rcPaint.left, ps.rcPaint.bottom-ps.rcPaint.top);[m + [m + cb(ih, ih->data->posx, ih->data->posy);[m +[36m@@ -542,27 +546,13 @@[m [mstatic int winCanvasProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r[m + return iupwinBaseProc(ih, msg, wp, lp, result);[m + }[m + [m +[31m-static void winCanvasRegisterClass(void)[m +[31m-{[m +[31m- WNDCLASS wndclass;[m +[31m- ZeroMemory(&wndclass, sizeof(WNDCLASS));[m +[31m- [m +[31m- wndclass.hInstance = iupwin_hinstance;[m +[31m- wndclass.lpszClassName = "IupCanvas";[m +[31m- wndclass.lpfnWndProc = (WNDPROC)iupwinBaseWinProc;[m +[31m- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);[m +[31m- wndclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; /* using CS_OWNDC will minimize the work of cdActivate in the CD library */[m +[31m- wndclass.hbrBackground = NULL; /* remove the background to optimize redraw */[m +[31m- [m +[31m- RegisterClass(&wndclass);[m +[31m-}[m +[31m-[m + static int winCanvasMapMethod(Ihandle* ih)[m + {[m + CLIENTCREATESTRUCT clientstruct;[m + void *clientdata = NULL;[m + char *classname;[m +[31m- DWORD dwStyle = WS_CHILD, dwExStyle = 0;[m +[32m+[m[32m DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS,[m[41m [m +[32m+[m[32m dwExStyle = 0;[m + [m + if (!ih->parent)[m + return IUP_ERROR;[m +[36m@@ -574,14 +564,7 @@[m [mstatic int winCanvasMapMethod(Ihandle* ih)[m + }[m + [m + if (ih->firstchild) /* can be a container */[m +[31m- {[m +[31m- dwStyle |= WS_CLIPSIBLINGS;[m +[31m-[m +[31m- if (iupAttribGetBoolean(IupGetDialog(ih), "COMPOSITED"))[m +[31m- dwExStyle |= WS_EX_COMPOSITED;[m +[31m- else[m +[31m- dwStyle |= WS_CLIPCHILDREN;[m +[31m- }[m +[32m+[m[32m iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle);[m + [m + if (iupAttribGetBoolean(ih, "MDICLIENT")) [m + {[m +[36m@@ -693,6 +676,21 @@[m [mstatic void winCanvasReleaseMethod(Iclass* ic)[m + UnregisterClass("IupCanvas", iupwin_hinstance);[m + }[m + [m +[32m+[m[32mstatic void winCanvasRegisterClass(void)[m +[32m+[m[32m{[m +[32m+[m[32m WNDCLASS wndclass;[m +[32m+[m[32m ZeroMemory(&wndclass, sizeof(WNDCLASS));[m +[32m+[m[41m [m +[32m+[m[32m wndclass.hInstance = iupwin_hinstance;[m +[32m+[m[32m wndclass.lpszClassName = "IupCanvas";[m +[32m+[m[32m wndclass.lpfnWndProc = (WNDPROC)iupwinBaseWinProc;[m +[32m+[m[32m wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);[m +[32m+[m[32m wndclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; /* using CS_OWNDC will minimize the work of cdActivate in the CD library */[m +[32m+[m[32m wndclass.hbrBackground = NULL; /* remove the background to optimize redraw */[m +[32m+[m[41m [m +[32m+[m[32m RegisterClass(&wndclass);[m +[32m+[m[32m}[m +[32m+[m + void iupdrvCanvasInitClass(Iclass* ic)[m + {[m + if (!iupwinClassExist("IupCanvas"))[m +[1mdiff --git a/iup/src/win/iupwin_common.c b/iup/src/win/iupwin_common.c[m +[1mindex a1a7c0f..ba68b78 100755[m +[1m--- a/iup/src/win/iupwin_common.c[m +[1m+++ b/iup/src/win/iupwin_common.c[m +[36m@@ -94,16 +94,17 @@[m [mvoid iupdrvBaseLayoutUpdateMethod(Ihandle *ih)[m + SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOOWNERZORDER);[m + }[m + [m +[31m-void iupdrvDisplayRedraw(Ihandle *ih)[m +[32m+[m[32mvoid iupdrvRedrawNow(Ihandle *ih)[m + {[m + /* REDRAW Now */[m +[31m- RedrawWindow(ih->handle,NULL,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_INTERNALPAINT|RDW_NOCHILDREN|RDW_UPDATENOW);[m +[32m+[m[32m RedrawWindow(ih->handle,NULL,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_INTERNALPAINT|RDW_UPDATENOW);[m + }[m + [m +[31m-void iupdrvDisplayUpdate(Ihandle *ih)[m +[32m+[m[32mvoid iupdrvPostRedraw(Ihandle *ih)[m + {[m + /* Post a REDRAW */[m +[31m- RedrawWindow(ih->handle,NULL,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_INTERNALPAINT|RDW_NOCHILDREN);[m +[32m+[m[32m /* can NOT use RDW_NOCHILDREN because IupList has internal children that needs to be redraw */[m +[32m+[m[32m RedrawWindow(ih->handle,NULL,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_INTERNALPAINT);[m[41m [m + }[m + [m + void iupdrvScreenToClient(Ihandle* ih, int *x, int *y)[m +[36m@@ -534,6 +535,8 @@[m [mint iupdrvBaseSetZorderAttrib(Ihandle* ih, const char* value)[m + [m + void iupdrvSetVisible(Ihandle* ih, int visible)[m + {[m +[32m+[m[32m if (iupStrEqual(ih->iclass->name, "colorbar"))[m +[32m+[m[32m ih=ih;[m + ShowWindow(ih->handle, visible? SW_SHOWNORMAL: SW_HIDE);[m + }[m + [m +[36m@@ -618,6 +621,18 @@[m [mchar* iupdrvBaseGetClientSizeAttrib(Ihandle* ih)[m + #define IDC_HELP MAKEINTRESOURCE(32651)[m + #endif[m + [m +[32m+[m[32mstatic HCURSOR winLoadComCtlCursor(LPCTSTR lpCursorName)[m +[32m+[m[32m{[m +[32m+[m[32m HCURSOR cur = NULL;[m +[32m+[m[32m HINSTANCE hinstDll = LoadLibrary("comctl32.dll");[m +[32m+[m[32m if (hinstDll)[m +[32m+[m[32m {[m +[32m+[m[32m cur = LoadCursor(hinstDll, lpCursorName);[m +[32m+[m[32m FreeLibrary(hinstDll);[m +[32m+[m[32m }[m +[32m+[m[32m return cur;[m +[32m+[m[32m}[m +[32m+[m + static HCURSOR winGetCursor(Ihandle* ih, const char* name)[m + {[m + static struct {[m +[36m@@ -649,7 +664,7 @@[m [mstatic HCURSOR winGetCursor(Ihandle* ih, const char* name)[m + {"APPSTARTING", IDC_APPSTARTING}[m + };[m + [m +[31m- HCURSOR cur;[m +[32m+[m[32m HCURSOR cur = NULL;[m + char str[50];[m + int i, count = sizeof(table)/sizeof(table[0]);[m + [m +[36m@@ -676,14 +691,22 @@[m [mstatic HCURSOR winGetCursor(Ihandle* ih, const char* name)[m + if (i == count)[m + {[m + /* check other system cursors */[m +[31m- /* cursor PEN is handled here */[m +[32m+[m + if (iupStrEqualNoCase(name, "PEN"))[m +[31m- name = "CURSOR_PEN";[m +[32m+[m[32m name = "CURSOR_PEN"; /* name in "iup.rc" */[m + [m + /* check for an name defined cursor */[m + cur = iupImageGetCursor(name);[m + }[m + [m +[32m+[m[32m if (!cur)[m +[32m+[m[32m {[m +[32m+[m[32m if (iupStrEqualNoCase(name, "SPLITTER_VERT"))[m +[32m+[m[32m cur = winLoadComCtlCursor(MAKEINTRESOURCE(107));[m +[32m+[m[32m else if (iupStrEqualNoCase(name, "SPLITTER_HORIZ"))[m +[32m+[m[32m cur = winLoadComCtlCursor(MAKEINTRESOURCE(135));[m +[32m+[m[32m }[m +[32m+[m + iupAttribSetStr(ih, str, (char*)cur);[m + return cur;[m + }[m +[36m@@ -758,29 +781,29 @@[m [mint iupwinButtonUp(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp)[m + if (msg==WM_LBUTTONUP)[m + {[m + b = IUP_BUTTON1;[m +[31m- iupKEYSETBUTTON1(status); [m +[32m+[m[32m iupKEY_SETBUTTON1(status);[m[41m [m + }[m + else if (msg==WM_MBUTTONUP)[m + {[m + b = IUP_BUTTON2;[m +[31m- iupKEYSETBUTTON2(status);[m +[32m+[m[32m iupKEY_SETBUTTON2(status);[m + }[m + else if (msg==WM_RBUTTONUP)[m + {[m + b = IUP_BUTTON3;[m +[31m- iupKEYSETBUTTON3(status);[m +[32m+[m[32m iupKEY_SETBUTTON3(status);[m + }[m + else if (msg==WM_XBUTTONUP)[m + {[m + if (HIWORD(wp) == XBUTTON1)[m + {[m + b = IUP_BUTTON4;[m +[31m- iupKEYSETBUTTON4(status);[m +[32m+[m[32m iupKEY_SETBUTTON4(status);[m + }[m + else[m + {[m + b = IUP_BUTTON5;[m +[31m- iupKEYSETBUTTON5(status);[m +[32m+[m[32m iupKEY_SETBUTTON5(status);[m + }[m + }[m + [m +[36m@@ -807,6 +830,14 @@[m [mint iupwinMouseMove(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp)[m + return 0;[m + }[m + [m +[32m+[m[32mvoid iupwinGetNativeParentStyle(Ihandle* ih, DWORD *dwExStyle, DWORD *dwStyle)[m +[32m+[m[32m{[m +[32m+[m[32m *dwStyle |= WS_CLIPCHILDREN;[m +[32m+[m +[32m+[m[32m if (iupAttribGetBoolean(IupGetDialog(ih), "COMPOSITED"))[m +[32m+[m[32m *dwExStyle |= WS_EX_COMPOSITED;[m +[32m+[m[32m}[m +[32m+[m + int iupwinCreateWindowEx(Ihandle* ih, LPCSTR lpClassName, DWORD dwExStyle, DWORD dwStyle)[m + {[m + ih->serial = iupDialogGetChildId(ih);[m +[1mdiff --git a/iup/src/win/iupwin_dialog.c b/iup/src/win/iupwin_dialog.c[m +[1mindex 39fdc0c..c13b88d 100755[m +[1m--- a/iup/src/win/iupwin_dialog.c[m +[1m+++ b/iup/src/win/iupwin_dialog.c[m +[36m@@ -102,9 +102,9 @@[m [mvoid iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu[m + else[m + {[m + int has_titlebar = iupAttribGetBoolean(ih, "MAXBOX") ||[m +[31m- iupAttribGetBoolean(ih, "MINBOX") ||[m +[31m- iupAttribGetBoolean(ih, "MENUBOX") || [m +[31m- IupGetAttribute(ih, "TITLE"); /* must use IupGetAttribute to check from the native implementation */[m +[32m+[m[32m iupAttribGetBoolean(ih, "MINBOX") ||[m +[32m+[m[32m iupAttribGetBoolean(ih, "MENUBOX") ||[m[41m [m +[32m+[m[32m IupGetAttribute(ih, "TITLE"); /* must use IupGetAttribute to check from the native implementation */[m + [m + *caption = 0;[m + if (has_titlebar)[m +[36m@@ -118,14 +118,17 @@[m [mvoid iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu[m + *border = 0;[m + if (iupAttribGetBoolean(ih, "RESIZE"))[m + {[m +[32m+[m[32m /* has_border */[m + *border = GetSystemMetrics(SM_CXFRAME); /* Thickness of the sizing border around the perimeter of a window */[m + } /* that can be resized, in pixels. */[m + else if (has_titlebar)[m + {[m +[32m+[m[32m /* has_border */[m + *border = GetSystemMetrics(SM_CXFIXEDFRAME); /* Thickness of the frame around the perimeter of a window */[m + } /* that has a caption but is not sizable, in pixels. */[m + else if (iupAttribGetBoolean(ih, "BORDER"))[m + {[m +[32m+[m[32m /* has_border */[m + *border = GetSystemMetrics(SM_CXBORDER);[m + }[m + }[m +[36m@@ -712,28 +715,27 @@[m [mstatic int winDialogMapMethod(Ihandle* ih)[m + }[m + [m + if (iupAttribGetBoolean(ih, "RESIZE"))[m +[32m+[m[32m {[m + dwStyle |= WS_THICKFRAME;[m +[32m+[m[32m has_border = 1;[m +[32m+[m[32m }[m + else[m + iupAttribSetStr(ih, "MAXBOX", "NO"); /* Must also remove this to RESIZE=NO work */[m +[31m-[m + if (iupAttribGetBoolean(ih, "MAXBOX"))[m + {[m + dwStyle |= WS_MAXIMIZEBOX;[m + has_titlebar = 1;[m + }[m +[31m-[m + if (iupAttribGetBoolean(ih, "MINBOX"))[m + {[m + dwStyle |= WS_MINIMIZEBOX;[m + has_titlebar = 1;[m + }[m +[31m-[m + if (iupAttribGetBoolean(ih, "MENUBOX"))[m + {[m + dwStyle |= WS_SYSMENU;[m + has_titlebar = 1;[m + }[m +[31m-[m + if (iupAttribGetBoolean(ih, "BORDER") || has_titlebar)[m + has_border = 1;[m + [m +[36m@@ -815,10 +817,7 @@[m [mstatic int winDialogMapMethod(Ihandle* ih)[m + if (iupAttribGetBoolean(ih, "DIALOGFRAME") && native_parent)[m + dwExStyle |= WS_EX_DLGMODALFRAME; /* this will hide the MENUBOX but not the close button */[m + [m +[31m- if (iupAttribGetBoolean(ih, "COMPOSITED"))[m +[31m- dwExStyle |= WS_EX_COMPOSITED;[m +[31m- else[m +[31m- dwStyle |= WS_CLIPCHILDREN;[m +[32m+[m[32m iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle);[m + [m + if (iupAttribGetBoolean(ih, "HELPBUTTON"))[m + dwExStyle |= WS_EX_CONTEXTHELP;[m +[36m@@ -878,7 +877,6 @@[m [mstatic int winDialogMapMethod(Ihandle* ih)[m + /* Reset attributes handled during creation that */[m + /* also can be changed later, and can be consulted from the native system. */[m + iupAttribSetStr(ih, "TITLE", NULL); [m +[31m- iupAttribSetStr(ih, "BORDER", NULL);[m + [m + /* Ignore VISIBLE before mapping */[m + iupAttribSetStr(ih, "VISIBLE", NULL);[m +[36m@@ -956,7 +954,7 @@[m [mstatic int winDialogSetBgColorAttrib(Ihandle* ih, const char* value)[m + {[m + iupAttribStoreStr(ih, "_IUPWIN_BACKGROUND_COLOR", value);[m + iupAttribSetStr(ih, "_IUPWIN_BACKGROUND_BITMAP", NULL);[m +[31m- RedrawWindow(ih->handle, NULL, NULL, RDW_ERASE|RDW_ERASENOW); /* force a WM_ERASEBKGND now */[m +[32m+[m[32m RedrawWindow(ih->handle, NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); /* post WM_ERASEBKGND and WM_PAINT */[m + return 1;[m + }[m + return 0;[m +[36m@@ -973,7 +971,7 @@[m [mstatic int winDialogSetBackgroundAttrib(Ihandle* ih, const char* value)[m + {[m + iupAttribSetStr(ih, "_IUPWIN_BACKGROUND_COLOR", NULL);[m + iupAttribSetStr(ih, "_IUPWIN_BACKGROUND_BITMAP", (char*)hBitmap);[m +[31m- RedrawWindow(ih->handle, NULL, NULL, RDW_ERASE|RDW_ERASENOW); /* force a WM_ERASEBKGND now */[m +[32m+[m[32m RedrawWindow(ih->handle, NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN); /* post WM_ERASEBKGND and WM_PAINT */[m + return 1;[m + }[m + }[m +[1mdiff --git a/iup/src/win/iupwin_draw.c b/iup/src/win/iupwin_draw.c[m +[1mindex 4a810e6..f663d20 100755[m +[1m--- a/iup/src/win/iupwin_draw.c[m +[1m+++ b/iup/src/win/iupwin_draw.c[m +[36m@@ -14,12 +14,16 @@[m + #include <stdio.h>[m + #include <string.h>[m + #include <memory.h>[m +[32m+[m[32m#include <math.h>[m + [m + #include "iup.h"[m + [m + #include "iup_attrib.h"[m + #include "iup_class.h"[m + #include "iup_str.h"[m +[32m+[m[32m#include "iup_object.h"[m +[32m+[m[32m#include "iup_image.h"[m +[32m+[m[32m#include "iup_draw.h"[m + [m + #include "iupwin_drv.h"[m + #include "iupwin_info.h"[m +[36m@@ -38,6 +42,11 @@[m + #endif[m + [m + [m +[32m+[m[32m/******************************************************************************[m +[32m+[m[32m Themes[m +[32m+[m[32m*******************************************************************************/[m +[32m+[m +[32m+[m + typedef HTHEME (STDAPICALLTYPE *_winThemeOpenData)(HWND hwnd, LPCWSTR pszClassList);[m + typedef HRESULT (STDAPICALLTYPE *_winThemeCloseData)(HTHEME hTheme);[m + typedef HRESULT (STDAPICALLTYPE *_winThemeDrawBackground)(HTHEME hTheme, HDC hDC, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect);[m +[36m@@ -61,58 +70,6 @@[m [mstatic int winDrawThemeEnabled(void)[m + return winThemeOpenData? 1: 0;[m + }[m + [m +[31m-void iupwinDrawText(HDC hDC, const char* text, int x, int y, int width, int height, HFONT hFont, COLORREF fgcolor, int style)[m +[31m-{[m +[31m- COLORREF oldcolor;[m +[31m- RECT rect;[m +[31m- HFONT hOldFont = SelectObject(hDC, hFont);[m +[31m-[m +[31m- rect.left = x;[m +[31m- rect.top = y;[m +[31m- rect.right = x+width;[m +[31m- rect.bottom = y+height;[m +[31m-[m +[31m- SetTextAlign(hDC, TA_TOP|TA_LEFT);[m +[31m- SetBkMode(hDC, TRANSPARENT);[m +[31m- oldcolor = SetTextColor(hDC, fgcolor);[m +[31m-[m +[31m- DrawText(hDC, text, -1, &rect, style|DT_NOCLIP);[m +[31m-[m +[31m- SelectObject(hDC, hOldFont);[m +[31m- SetTextColor(hDC, oldcolor);[m +[31m- SetBkMode(hDC, OPAQUE);[m +[31m-}[m +[31m-[m +[31m-void iupwinDrawBitmap(HDC hDC, HBITMAP hBitmap, HBITMAP hMask, int x, int y, int width, int height, int bpp)[m +[31m-{[m +[31m- HDC hMemDC = CreateCompatibleDC(hDC);[m +[31m- SelectObject(hMemDC, hBitmap);[m +[31m-[m +[31m- if (bpp == 32 && winAlphaBlend)[m +[31m- {[m +[31m- BLENDFUNCTION blendfunc;[m +[31m- blendfunc.BlendOp = AC_SRC_OVER;[m +[31m- blendfunc.BlendFlags = 0;[m +[31m- blendfunc.SourceConstantAlpha = 0xFF;[m +[31m- blendfunc.AlphaFormat = AC_SRC_ALPHA;[m +[31m-[m +[31m- winAlphaBlend(hDC, x, y, width, height, [m +[31m- hMemDC, 0, 0, width, height, [m +[31m- blendfunc);[m +[31m- }[m +[31m- else if (bpp == 8 && hMask)[m +[31m- MaskBlt(hDC, x, y, width, height, [m +[31m- hMemDC, 0, 0, [m +[31m- hMask, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));[m +[31m- else[m +[31m- BitBlt(hDC, x, y, width, height, [m +[31m- hMemDC, 0, 0, [m +[31m- SRCCOPY);[m +[31m-[m +[31m-[m +[31m- DeleteDC(hMemDC);[m +[31m-}[m +[31m-[m + void iupwinDrawInit(void)[m + {[m + if (!winAlphaBlend)[m +[36m@@ -201,7 +158,7 @@[m [mint iupwinDrawGetThemeTabsBgColor(HWND hWnd, COLORREF *color)[m + if (!hTheme) [m + return 0;[m + [m +[31m- if (iupwinIsVista())[m +[32m+[m[32m if (iupwinIsVistaOrNew())[m + ret = winThemeGetColor(hTheme, TABP_AEROWIZARDBODY, TIS_NORMAL, TMT_FILLCOLORHINT, color);[m + else[m + ret = winThemeGetColor(hTheme, TABP_BODY, TIS_NORMAL, TMT_FILLCOLORHINT, color);[m +[36m@@ -246,6 +203,79 @@[m [mint iupwinDrawGetThemeFrameFgColor(HWND hWnd, COLORREF *color)[m + return (ret == S_OK)? 1: 0;[m + }[m + [m +[32m+[m[32mvoid iupwinDrawRemoveTheme(HWND hwnd)[m +[32m+[m[32m{[m +[32m+[m[32m typedef HRESULT (STDAPICALLTYPE *winSetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList);[m +[32m+[m[32m static winSetWindowTheme mySetWindowTheme = NULL;[m +[32m+[m[32m if (!mySetWindowTheme)[m +[32m+[m[32m {[m +[32m+[m[32m HMODULE hinstDll = LoadLibrary("uxtheme.dll");[m +[32m+[m[32m if (hinstDll)[m +[32m+[m[32m mySetWindowTheme = (winSetWindowTheme)GetProcAddress(hinstDll, "SetWindowTheme");[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m if (mySetWindowTheme)[m +[32m+[m[32m mySetWindowTheme(hwnd, L"", L"");[m +[32m+[m[32m}[m +[32m+[m +[32m+[m +[32m+[m[32m/******************************************************************************[m +[32m+[m[32m Utilities[m +[32m+[m[32m*******************************************************************************/[m +[32m+[m +[32m+[m +[32m+[m[32mvoid iupwinDrawText(HDC hDC, const char* text, int x, int y, int width, int height, HFONT hFont, COLORREF fgcolor, int style)[m +[32m+[m[32m{[m +[32m+[m[32m COLORREF oldcolor;[m +[32m+[m[32m RECT rect;[m +[32m+[m[32m HFONT hOldFont = SelectObject(hDC, hFont);[m +[32m+[m +[32m+[m[32m rect.left = x;[m +[32m+[m[32m rect.top = y;[m +[32m+[m[32m rect.right = x+width;[m +[32m+[m[32m rect.bottom = y+height;[m +[32m+[m +[32m+[m[32m SetTextAlign(hDC, TA_TOP|TA_LEFT);[m +[32m+[m[32m SetBkMode(hDC, TRANSPARENT);[m +[32m+[m[32m oldcolor = SetTextColor(hDC, fgcolor);[m +[32m+[m +[32m+[m[32m DrawText(hDC, text, -1, &rect, style|DT_NOCLIP);[m +[32m+[m +[32m+[m[32m SelectObject(hDC, hOldFont);[m +[32m+[m[32m SetTextColor(hDC, oldcolor);[m +[32m+[m[32m SetBkMode(hDC, OPAQUE);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupwinDrawBitmap(HDC hDC, HBITMAP hBitmap, HBITMAP hMask, int x, int y, int width, int height, int bpp)[m +[32m+[m[32m{[m +[32m+[m[32m HDC hMemDC = CreateCompatibleDC(hDC);[m +[32m+[m[32m SelectObject(hMemDC, hBitmap);[m +[32m+[m +[32m+[m[32m if (bpp == 32 && winAlphaBlend)[m +[32m+[m[32m {[m +[32m+[m[32m BLENDFUNCTION blendfunc;[m +[32m+[m[32m blendfunc.BlendOp = AC_SRC_OVER;[m +[32m+[m[32m blendfunc.BlendFlags = 0;[m +[32m+[m[32m blendfunc.SourceConstantAlpha = 0xFF;[m +[32m+[m[32m blendfunc.AlphaFormat = AC_SRC_ALPHA;[m +[32m+[m +[32m+[m[32m winAlphaBlend(hDC, x, y, width, height,[m[41m [m +[32m+[m[32m hMemDC, 0, 0, width, height,[m[41m [m +[32m+[m[32m blendfunc);[m +[32m+[m[32m }[m +[32m+[m[32m else if (bpp == 8 && hMask)[m +[32m+[m[32m MaskBlt(hDC, x, y, width, height,[m[41m [m +[32m+[m[32m hMemDC, 0, 0,[m[41m [m +[32m+[m[32m hMask, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));[m +[32m+[m[32m else[m +[32m+[m[32m BitBlt(hDC, x, y, width, height,[m[41m [m +[32m+[m[32m hMemDC, 0, 0,[m[41m [m +[32m+[m[32m SRCCOPY);[m +[32m+[m +[32m+[m +[32m+[m[32m DeleteDC(hMemDC);[m +[32m+[m[32m}[m +[32m+[m + static int winDrawGetStateId(int itemState)[m + {[m + if (itemState & ODS_DISABLED)[m +[36m@@ -282,21 +312,6 @@[m [mvoid iupdrvDrawFocusRect(Ihandle* ih, void* gc, int x, int y, int w, int h)[m + DrawFocusRect(hDC, &rect);[m + }[m + [m +[31m-void iupwinDrawRemoveTheme(HWND hwnd)[m +[31m-{[m +[31m- typedef HRESULT (STDAPICALLTYPE *winSetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList);[m +[31m- static winSetWindowTheme mySetWindowTheme = NULL;[m +[31m- if (!mySetWindowTheme)[m +[31m- {[m +[31m- HMODULE hinstDll = LoadLibrary("uxtheme.dll");[m +[31m- if (hinstDll)[m +[31m- mySetWindowTheme = (winSetWindowTheme)GetProcAddress(hinstDll, "SetWindowTheme");[m +[31m- }[m +[31m-[m +[31m- if (mySetWindowTheme)[m +[31m- mySetWindowTheme(hwnd, L"", L"");[m +[31m-}[m +[31m-[m + void iupwinDrawParentBackground(Ihandle* ih, HDC hDC, RECT* rect)[m + {[m + unsigned char r=0, g=0, b=0;[m +[36m@@ -326,3 +341,226 @@[m [mvoid iupwinDrawDestroyBitmapDC(iupwinBitmapDC *bmpDC)[m + DeleteDC(bmpDC->hBitmapDC);[m + }[m + [m +[32m+[m +[32m+[m[32m/******************************************************************************[m +[32m+[m[32m Simple Draw[m +[32m+[m[32m*******************************************************************************/[m +[32m+[m +[32m+[m[32mstruct _IdrawCanvas{[m +[32m+[m[32m Ihandle* ih;[m +[32m+[m[32m int w, h;[m +[32m+[m +[32m+[m[32m int release_dc;[m +[32m+[m[32m HBITMAP hBitmap, hOldBitmap;[m +[32m+[m[32m HDC hBitmapDC, hDC;[m +[32m+[m[32m};[m +[32m+[m +[32m+[m[32mIdrawCanvas* iupDrawCreateCanvas(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m IdrawCanvas* dc = calloc(1, sizeof(IdrawCanvas));[m +[32m+[m[32m RECT rect;[m +[32m+[m +[32m+[m[32m /* valid only inside the ACTION callback of an IupCanvas */[m +[32m+[m[32m dc->hDC = (HDC)IupGetAttribute(ih, "HDC_WMPAINT");[m +[32m+[m[32m if (!dc->hDC)[m +[32m+[m[32m {[m +[32m+[m[32m dc->hDC = GetDC(ih->handle);[m +[32m+[m[32m dc->release_dc = 1;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m GetClientRect(ih->handle, &rect);[m +[32m+[m[32m dc->w = rect.right - rect.left;[m +[32m+[m[32m dc->h = rect.bottom - rect.top;[m +[32m+[m +[32m+[m[32m dc->hBitmap = CreateCompatibleBitmap(dc->hDC, dc->w, dc->h);[m +[32m+[m[32m dc->hBitmapDC = CreateCompatibleDC(dc->hDC);[m +[32m+[m[32m dc->hOldBitmap = SelectObject(dc->hBitmapDC, dc->hBitmap);[m +[32m+[m +[32m+[m[32m SetBkMode(dc->hBitmapDC, TRANSPARENT);[m +[32m+[m[32m SetTextAlign(dc->hBitmapDC, TA_TOP|TA_LEFT);[m +[32m+[m +[32m+[m[32m return dc;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawKillCanvas(IdrawCanvas* dc)[m +[32m+[m[32m{[m +[32m+[m[32m SelectObject(dc->hBitmapDC, dc->hOldBitmap);[m +[32m+[m[32m DeleteObject(dc->hBitmap);[m +[32m+[m[32m DeleteDC(dc->hBitmapDC);[m +[32m+[m[32m if (dc->release_dc)[m +[32m+[m[32m DeleteDC(dc->hDC);[m +[32m+[m +[32m+[m[32m free(dc);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawUpdateSize(IdrawCanvas* dc)[m +[32m+[m[32m{[m +[32m+[m[32m int w, h;[m +[32m+[m[32m RECT rect;[m +[32m+[m[32m GetClientRect(dc->ih->handle, &rect);[m +[32m+[m[32m w = rect.right - rect.left;[m +[32m+[m[32m h = rect.bottom - rect.top;[m +[32m+[m +[32m+[m[32m if (w != dc->w || h != dc->h)[m +[32m+[m[32m {[m +[32m+[m[32m SelectObject(dc->hBitmapDC, dc->hOldBitmap);[m +[32m+[m[32m DeleteObject(dc->hBitmap);[m +[32m+[m[32m DeleteDC(dc->hBitmapDC);[m +[32m+[m +[32m+[m[32m dc->hBitmap = CreateCompatibleBitmap(dc->hDC, dc->w, dc->h);[m +[32m+[m[32m dc->hBitmapDC = CreateCompatibleDC(dc->hDC);[m +[32m+[m[32m dc->hOldBitmap = SelectObject(dc->hBitmapDC, dc->hBitmap);[m +[32m+[m +[32m+[m[32m SetBkMode(dc->hBitmapDC, TRANSPARENT);[m +[32m+[m[32m SetTextAlign(dc->hBitmapDC, TA_TOP|TA_LEFT);[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawFlush(IdrawCanvas* dc)[m +[32m+[m[32m{[m +[32m+[m[32m BitBlt(dc->hDC, 0, 0, dc->w, dc->h, dc->hBitmapDC, 0, 0, SRCCOPY);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawGetSize(IdrawCanvas* dc, int *w, int *h)[m +[32m+[m[32m{[m +[32m+[m[32m if (w) *w = dc->w;[m +[32m+[m[32m if (h) *h = dc->h;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawParentBackground(IdrawCanvas* dc)[m +[32m+[m[32m{[m +[32m+[m[32m unsigned char r=0, g=0, b=0;[m +[32m+[m[32m char* color = iupBaseNativeParentGetBgColorAttrib(dc->ih);[m +[32m+[m[32m iupStrToRGB(color, &r, &g, &b);[m +[32m+[m[32m iupDrawRectangle(dc, 0, 0, dc->w-1, dc->h-1, r, g, b, 1);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawRectangle(IdrawCanvas* dc, int x1, int y1, int x2, int y2, unsigned char r, unsigned char g, unsigned char b, int filled)[m +[32m+[m[32m{[m +[32m+[m[32m RECT rect;[m +[32m+[m[32m rect.left = x1; rect.top = y1; rect.right = x2+1; rect.bottom = y2+1;[m +[32m+[m[32m SetDCBrushColor(dc->hBitmapDC, RGB(r,g,b));[m +[32m+[m[32m if (filled)[m +[32m+[m[32m FillRect(dc->hBitmapDC, &rect, (HBRUSH)GetStockObject(DC_BRUSH));[m +[32m+[m[32m else[m +[32m+[m[32m FrameRect(dc->hBitmapDC, &rect, (HBRUSH)GetStockObject(DC_BRUSH));[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawLine(IdrawCanvas* dc, int x1, int y1, int x2, int y2, unsigned char r, unsigned char g, unsigned char b)[m +[32m+[m[32m{[m +[32m+[m[32m POINT line_poly[2];[m +[32m+[m[32m HPEN hPen = CreatePen(PS_SOLID, 1, RGB(r, g, b));[m +[32m+[m[32m HPEN hPenOld = SelectObject(dc->hBitmapDC, hPen);[m +[32m+[m[32m line_poly[0].x = x1;[m +[32m+[m[32m line_poly[0].y = y1;[m +[32m+[m[32m line_poly[1].x = x2;[m +[32m+[m[32m line_poly[1].y = y2;[m +[32m+[m[32m Polyline(dc->hBitmapDC, line_poly, 2);[m +[32m+[m[32m SelectObject(dc->hBitmapDC, hPenOld);[m +[32m+[m[32m DeleteObject(hPen);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32m#define IUP_DEG2RAD 0.01745329252 /* degrees to radians (rad = CD_DEG2RAD * deg) */[m +[32m+[m +[32m+[m[32mstatic int winDrawCalcArc(int c1, int c2, double a, int start)[m +[32m+[m[32m{[m +[32m+[m[32m double proj, off;[m +[32m+[m[32m if (start)[m +[32m+[m[32m proj = cos(IUP_DEG2RAD * a);[m +[32m+[m[32m else[m +[32m+[m[32m proj = sin(IUP_DEG2RAD * a);[m +[32m+[m[32m off = (c2+c1)/2.0 + (c2-c1+1)*proj/2.0;[m +[32m+[m[32m return iupROUND(off);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawArc(IdrawCanvas* dc, int x1, int y1, int x2, int y2, double a1, double a2, unsigned char r, unsigned char g, unsigned char b, int filled)[m +[32m+[m[32m{[m +[32m+[m[32m int XStartArc = winDrawCalcArc(x1, x2, a1, 1);[m +[32m+[m[32m int XEndArc = winDrawCalcArc(x1, x2, a2, 0);[m +[32m+[m[32m int YStartArc = winDrawCalcArc(y1, y2, a1, 1);[m +[32m+[m[32m int YEndArc = winDrawCalcArc(y1, y2, a2, 0);[m +[32m+[m +[32m+[m[32m if (filled)[m +[32m+[m[32m {[m +[32m+[m[32m HBRUSH hBrush = CreateSolidBrush(RGB(r,g,b));[m +[32m+[m[32m HPEN hBrushOld = SelectObject(dc->hBitmapDC, hBrush);[m[41m [m +[32m+[m[32m BeginPath(dc->hBitmapDC);[m[41m [m +[32m+[m[32m Pie(dc->hBitmapDC, x1, y1, x2+1, y2+1, XStartArc, YStartArc, XEndArc, YEndArc);[m +[32m+[m[32m EndPath(dc->hBitmapDC);[m +[32m+[m[32m FillPath(dc->hBitmapDC);[m +[32m+[m[32m SelectObject(dc->hBitmapDC, hBrushOld);[m +[32m+[m[32m DeleteObject(hBrush);[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m HPEN hPen = CreatePen(PS_SOLID, 1, RGB(r, g, b));[m +[32m+[m[32m HPEN hPenOld = SelectObject(dc->hBitmapDC, hPen);[m +[32m+[m[32m Arc(dc->hBitmapDC, x1, y1, x2+1, y2+1, XStartArc, YStartArc, XEndArc, YEndArc);[m +[32m+[m[32m SelectObject(dc->hBitmapDC, hPenOld);[m +[32m+[m[32m DeleteObject(hPen);[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawPolygon(IdrawCanvas* dc, int* points, int count, unsigned char r, unsigned char g, unsigned char b, int filled)[m +[32m+[m[32m{[m +[32m+[m[32m if (filled)[m +[32m+[m[32m {[m +[32m+[m[32m HBRUSH hBrush = CreateSolidBrush(RGB(r,g,b));[m +[32m+[m[32m HPEN hBrushOld = SelectObject(dc->hBitmapDC, hBrush);[m[41m [m +[32m+[m[32m BeginPath(dc->hBitmapDC);[m[41m [m +[32m+[m[32m Polygon(dc->hBitmapDC, (POINT*)points, count);[m +[32m+[m[32m EndPath(dc->hBitmapDC);[m +[32m+[m[32m FillPath(dc->hBitmapDC);[m +[32m+[m[32m SelectObject(dc->hBitmapDC, hBrushOld);[m +[32m+[m[32m DeleteObject(hBrush);[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m HPEN hPen = CreatePen(PS_SOLID, 1, RGB(r, g, b));[m +[32m+[m[32m HPEN hPenOld = SelectObject(dc->hBitmapDC, hPen);[m +[32m+[m[32m Polyline(dc->hBitmapDC, (POINT*)points, count);[m +[32m+[m[32m SelectObject(dc->hBitmapDC, hPenOld);[m +[32m+[m[32m DeleteObject(hPen);[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawSetClipRect(IdrawCanvas* dc, int x1, int y1, int x2, int y2)[m +[32m+[m[32m{[m +[32m+[m[32m HRGN clip_hrgn = CreateRectRgn(x1, y1, x2, y2);[m +[32m+[m[32m SelectClipRgn(dc->hBitmapDC, clip_hrgn);[m +[32m+[m[32m DeleteObject(clip_hrgn);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawResetClip(IdrawCanvas* dc)[m +[32m+[m[32m{[m +[32m+[m[32m SelectClipRgn(dc->hBitmapDC, NULL);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawText(IdrawCanvas* dc, const char* text, int len, int x, int y, unsigned char r, unsigned char g, unsigned char b)[m +[32m+[m[32m{[m +[32m+[m[32m HFONT hOldFont, hFont = (HFONT)IupGetAttribute(dc->ih, "HFONT");[m +[32m+[m[32m SetTextColor(dc->hBitmapDC, RGB(r, g, b));[m +[32m+[m[32m hOldFont = SelectObject(dc->hBitmapDC, hFont);[m +[32m+[m[32m TextOut(dc->hBitmapDC, x, y, text, len);[m +[32m+[m[32m SelectObject(dc->hBitmapDC, hOldFont);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupDrawImage(IdrawCanvas* dc, const char* name, int make_inactive, int x, int y)[m +[32m+[m[32m{[m +[32m+[m[32m int img_w, img_h, bpp;[m +[32m+[m[32m HBITMAP hMask = NULL;[m +[32m+[m[32m HBITMAP hBitmap = iupImageGetImage(name, dc->ih, make_inactive);[m +[32m+[m[32m if (!hBitmap)[m +[32m+[m[32m return;[m +[32m+[m +[32m+[m[32m /* must use this info, since image can be a driver image loaded from resources */[m +[32m+[m[32m iupdrvImageGetInfo(hBitmap, &img_w, &img_h, &bpp);[m +[32m+[m +[32m+[m[32m if (bpp == 8)[m +[32m+[m[32m hMask = iupdrvImageCreateMask(IupGetHandle(name));[m +[32m+[m +[32m+[m[32m iupwinDrawBitmap(dc->hBitmapDC, hBitmap, hMask, x, y, img_w, img_h, bpp);[m +[32m+[m +[32m+[m[32m if (hMask)[m +[32m+[m[32m DeleteObject(hMask);[m +[32m+[m[32m}[m +[1mdiff --git a/iup/src/win/iupwin_drv.h b/iup/src/win/iupwin_drv.h[m +[1mindex 3372c1a..7407a7a 100755[m +[1m--- a/iup/src/win/iupwin_drv.h[m +[1m+++ b/iup/src/win/iupwin_drv.h[m +[36m@@ -77,6 +77,7 @@[m [mint iupwinBaseContainerProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT[m + /* Creates the Window with native parent and child ID, associate HWND with Ihandle*, [m + and replace the WinProc by iupwinBaseWinProc */[m + int iupwinCreateWindowEx(Ihandle* ih, LPCSTR lpClassName, DWORD dwExStyle, DWORD dwStyle);[m +[32m+[m[32mvoid iupwinGetNativeParentStyle(Ihandle* ih, DWORD *dwExStyle, DWORD *dwStyle);[m + [m + int iupwinClassExist(const char* name);[m + int iupwinGetColorRef(Ihandle *ih, char *name, COLORREF *color);[m +[36m@@ -97,8 +98,8 @@[m [mchar* iupwinGetClipboardText(Ihandle* ih);[m + int iupwinGetScreenRes(void);[m + /* 1 point = 1/72 inch */[m + /* pixel = (point/72)*(pixel/inch) */[m +[31m-#define IUPWIN_PT2PIXEL(_pt, _res) MulDiv(_pt, _res, 72) /* (((_pt)*(_res))/72) */[m +[31m-#define IUPWIN_PIXEL2PT(_pixel, _res) MulDiv(_pixel, 72, _res) /* (((_pixel)*72)/(_res)) */[m +[32m+[m[32m#define iupWIN_PT2PIXEL(_pt, _res) MulDiv(_pt, _res, 72) /* (((_pt)*(_res))/72) */[m +[32m+[m[32m#define iupWIN_PIXEL2PT(_pixel, _res) MulDiv(_pixel, 72, _res) /* (((_pixel)*72)/(_res)) */[m + [m + [m + /* child window identifier of the first MDI child window created,[m +[1mdiff --git a/iup/src/win/iupwin_filedlg.c b/iup/src/win/iupwin_filedlg.c[m +[1mindex da66b4b..26994e5 100755[m +[1m--- a/iup/src/win/iupwin_filedlg.c[m +[1m+++ b/iup/src/win/iupwin_filedlg.c[m +[36m@@ -63,7 +63,7 @@[m [mstatic INT CALLBACK winFileDlgBrowseCallback(HWND hWnd, UINT uMsg, LPARAM lParam[m + }[m + else if (uMsg == BFFM_SELCHANGED)[m + {[m +[31m- char* buffer = iupStrGetMemory(MAX_FILENAME_SIZE);[m +[32m+[m[32m char buffer[MAX_FILENAME_SIZE];[m + ITEMIDLIST* selecteditem = (ITEMIDLIST*)lParam;[m + buffer[0] = 0;[m + SHGetPathFromIDList(selecteditem, buffer);[m +[36m@@ -90,7 +90,7 @@[m [mstatic void winFileDlgGetFolder(Ihandle *ih)[m + browseinfo.pszDisplayName = buffer; [m + browseinfo.lpfn = winFileDlgBrowseCallback;[m + browseinfo.lParam = (LPARAM)ih;[m +[31m- browseinfo.ulFlags = BIF_NEWDIALOGSTYLE;[m +[32m+[m[32m browseinfo.ulFlags = IupGetGlobal("_IUPWIN_COINIT_MULTITHREADED")? 0: BIF_NEWDIALOGSTYLE;[m + browseinfo.hwndOwner = parent;[m + [m + selecteditem = SHBrowseForFolder(&browseinfo);[m +[36m@@ -112,6 +112,37 @@[m [mstatic void winFileDlgGetFolder(Ihandle *ih)[m + [m + /************************************************************************************************/[m + [m +[32m+[m[32mstatic int winFileDlgGetSelectedFile(Ihandle* ih, HWND hWnd, char* filename)[m +[32m+[m[32m{[m +[32m+[m[32m int ret = CommDlg_OpenSave_GetFilePath(GetParent(hWnd), filename, MAX_FILENAME_SIZE);[m +[32m+[m[32m if (ret < 0)[m +[32m+[m[32m return 0;[m +[32m+[m +[32m+[m[32m if (iupAttribGetBoolean(ih, "MULTIPLEFILES"))[m +[32m+[m[32m {[m +[32m+[m[32m /* check if there are more than 1 files and return only the first one */[m +[32m+[m[32m int found = 0;[m +[32m+[m[32m while(*filename != 0)[m +[32m+[m[32m {[m[41m [m +[32m+[m[32m if (*filename == '"')[m +[32m+[m[32m {[m +[32m+[m[32m if (!found)[m +[32m+[m[32m found = 1;[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m *(filename-1) = 0;[m +[32m+[m[32m return 1;[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m[32m if (found)[m +[32m+[m[32m *filename = *(filename+1);[m +[32m+[m[32m filename++;[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m return 1;[m +[32m+[m[32m}[m +[32m+[m + static UINT_PTR CALLBACK winFileDlgSimpleHook(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)[m + {[m + (void)wParam;[m +[36m@@ -152,16 +183,15 @@[m [mstatic UINT_PTR CALLBACK winFileDlgSimpleHook(HWND hWnd, UINT uiMsg, WPARAM wPar[m + IFnss cb = (IFnss)IupGetCallback(ih, "FILE_CB");[m + if (cb)[m + {[m +[31m- char* filename = iupStrGetMemory(MAX_FILENAME_SIZE);[m +[31m- if (CommDlg_OpenSave_GetFilePath(GetParent(hWnd), filename, MAX_FILENAME_SIZE) <= MAX_FILENAME_SIZE)[m +[32m+[m[32m char filename[MAX_FILENAME_SIZE];[m +[32m+[m[32m if (winFileDlgGetSelectedFile(ih, hWnd, filename))[m + {[m + int ret;[m + char* file_msg;[m + [m + if (!iupdrvIsFile(filename))[m +[31m- break;[m +[31m-[m +[31m- if (pofn->hdr.code == CDN_FILEOK)[m +[32m+[m[32m file_msg = "OTHER";[m +[32m+[m[32m else if (pofn->hdr.code == CDN_FILEOK)[m + file_msg = "OK";[m + else [m + file_msg = "SELECT";[m +[36m@@ -267,9 +297,9 @@[m [mstatic UINT_PTR CALLBACK winFileDlgPreviewHook(HWND hWnd, UINT uiMsg, WPARAM wPa[m + LPDRAWITEMSTRUCT lpDrawItem = (LPDRAWITEMSTRUCT)lParam;[m + Ihandle* ih = (Ihandle*)GetWindowLongPtr(hWnd, DWLP_USER);[m + IFnss cb = (IFnss)IupGetCallback(ih, "FILE_CB");[m +[31m- char* filename = iupStrGetMemory(MAX_FILENAME_SIZE);[m +[32m+[m[32m char filename[MAX_FILENAME_SIZE];[m + iupAttribSetStr(ih, "PREVIEWDC", (char*)lpDrawItem->hDC);[m +[31m- if (CommDlg_OpenSave_GetFilePath(GetParent(hWnd), filename, MAX_FILENAME_SIZE) <= MAX_FILENAME_SIZE)[m +[32m+[m[32m if (winFileDlgGetSelectedFile(ih, hWnd, filename))[m + {[m + if (iupdrvIsFile(filename))[m + cb(ih, filename, "PAINT");[m +[36m@@ -324,16 +354,15 @@[m [mstatic UINT_PTR CALLBACK winFileDlgPreviewHook(HWND hWnd, UINT uiMsg, WPARAM wPa[m + case CDN_SELCHANGE:[m + {[m + HWND hWndPreview = GetDlgItem(hWnd, IUP_PREVIEWCANVAS);[m +[31m- char* filename = iupStrGetMemory(MAX_FILENAME_SIZE);[m +[31m- if (CommDlg_OpenSave_GetFilePath(GetParent(hWnd), filename, MAX_FILENAME_SIZE) <= MAX_FILENAME_SIZE)[m +[32m+[m[32m char filename[MAX_FILENAME_SIZE];[m +[32m+[m[32m if (winFileDlgGetSelectedFile(ih, hWnd, filename))[m + {[m + int ret;[m + char* file_msg;[m + [m + if (!iupdrvIsFile(filename))[m +[31m- break;[m +[31m-[m +[31m- if (pofn->hdr.code == CDN_FILEOK)[m +[32m+[m[32m file_msg = "OTHER";[m +[32m+[m[32m else if (pofn->hdr.code == CDN_FILEOK)[m + file_msg = "OK";[m + else[m + file_msg = "SELECT";[m +[36m@@ -520,9 +549,14 @@[m [mstatic int winFileDlgPopup(Ihandle *ih, int x, int y)[m + if (iupAttribGetBoolean(ih, "MULTIPLEFILES"))[m + {[m + int i = 0;[m +[31m- [m +[32m+[m +[32m+[m[32m char* dir = iupStrFileGetPath(openfilename.lpstrFile); /* the first part is the directory already */[m +[32m+[m[32m iupAttribStoreStr(ih, "DIRECTORY", dir);[m +[32m+[m[32m free(dir);[m +[32m+[m[41m [m + /* If there is more than one file, replace terminator by the separator */[m +[31m- if (openfilename.lpstrFile && openfilename.lpstrFile[openfilename.nFileOffset-1] == 0 && openfilename.nFileOffset>0) [m +[32m+[m[32m if (openfilename.lpstrFile[openfilename.nFileOffset-1] == 0 &&[m[41m [m +[32m+[m[32m openfilename.nFileOffset>0)[m[41m [m + {[m + while (openfilename.lpstrFile[i] != 0 || openfilename.lpstrFile[i+1] != 0)[m + {[m +[36m@@ -534,12 +568,16 @@[m [mstatic int winFileDlgPopup(Ihandle *ih, int x, int y)[m + }[m + [m + iupAttribSetStr(ih, "STATUS", "0");[m +[31m- iupAttribSetStr(ih, "FILEEXIST", NULL);[m +[32m+[m[32m iupAttribSetStr(ih, "FILEEXIST", "YES");[m + }[m + else[m + {[m + if (iupdrvIsFile(openfilename.lpstrFile)) /* check if file exists */[m + {[m +[32m+[m[32m char* dir = iupStrFileGetPath(openfilename.lpstrFile);[m +[32m+[m[32m iupAttribStoreStr(ih, "DIRECTORY", dir);[m +[32m+[m[32m free(dir);[m +[32m+[m + iupAttribSetStr(ih, "FILEEXIST", "YES");[m + iupAttribSetStr(ih, "STATUS", "0");[m + }[m +[1mdiff --git a/iup/src/win/iupwin_focus.c b/iup/src/win/iupwin_focus.c[m +[1mindex 63da02d..2328dea 100755[m +[1m--- a/iup/src/win/iupwin_focus.c[m +[1m+++ b/iup/src/win/iupwin_focus.c[m +[36m@@ -32,7 +32,7 @@[m + [m + /* Since Windows XP, the focus feedback only appears after the user press a key.[m + Except for the IupText where the feedback is the caret.[m +[31m- Before that if you click in a control the focus feedback will be hidden.[m +[32m+[m[32m Before a key is pressed if you click in a control the focus feedback will be hidden.[m + [m + We manually send WM_CHANGEUISTATE because we do not use IsDialogMessage anymore,[m + and the focus feedback was not shown even after the used press a key.[m +[36m@@ -43,19 +43,28 @@[m + void iupdrvSetFocus(Ihandle *ih)[m + {[m + SetFocus(ih->handle);[m +[31m- SendMessage(ih->handle, WM_CHANGEUISTATE, UIS_CLEAR|UISF_HIDEFOCUS, 0);[m +[32m+[m +[32m+[m[32m /* See comments above */[m +[32m+[m[32m SendMessage(ih->handle, WM_CHANGEUISTATE, UIS_CLEAR|UISF_HIDEFOCUS, 0); /* clear+hidefocus=showfocus */[m + }[m + [m + void iupwinWmSetFocus(Ihandle *ih)[m + {[m + Ihandle* dialog = IupGetDialog(ih);[m + if (ih != dialog)[m +[31m- iupAttribSetStr(dialog, "_IUPWIN_LASTFOCUS", (char*)ih); /* used by IupMenu */[m +[32m+[m[32m iupAttribSetStr(dialog, "_IUPWIN_LASTFOCUS", (char*)ih); /* used by IupMenu and here. */[m + else[m + {[m + /* if a control inside that dialog had the focus, then reset to it when the dialog gets the focus */[m + Ihandle* lastfocus = (Ihandle*)iupAttribGet(dialog, "_IUPWIN_LASTFOCUS");[m +[31m- if (lastfocus) IupSetFocus(lastfocus);[m +[32m+[m[32m if (lastfocus)[m +[32m+[m[32m {[m +[32m+[m[32m /* call the callback and update current focus before changing it again */[m +[32m+[m[32m iupCallGetFocusCb(ih);[m +[32m+[m +[32m+[m[32m IupSetFocus(lastfocus);[m +[32m+[m[32m return;[m +[32m+[m[32m }[m + }[m + [m + iupCallGetFocusCb(ih);[m +[1mdiff --git a/iup/src/win/iupwin_font.c b/iup/src/win/iupwin_font.c[m +[1mindex 659e2d9..c10befb 100755[m +[1m--- a/iup/src/win/iupwin_font.c[m +[1m+++ b/iup/src/win/iupwin_font.c[m +[36m@@ -70,7 +70,7 @@[m [mstatic IwinFont* winFindFont(const char *standardfont)[m + if (height < 0) [m + height_pixels = height; /* already in pixels */[m + else[m +[31m- height_pixels = -IUPWIN_PT2PIXEL(height, res);[m +[32m+[m[32m height_pixels = -iupWIN_PT2PIXEL(height, res);[m + [m + if (height_pixels == 0)[m + return NULL;[m +[36m@@ -119,7 +119,7 @@[m [mstatic void winFontFromLogFont(LOGFONT* logfont, char * font)[m + int is_strikeout = logfont->lfStrikeOut;[m + int height_pixels = logfont->lfHeight; /* negative value */[m + int res = iupwinGetScreenRes();[m +[31m- int height = IUPWIN_PIXEL2PT(-height_pixels, res); /* return in points */[m +[32m+[m[32m int height = iupWIN_PIXEL2PT(-height_pixels, res); /* return in points */[m + [m + sprintf(font, "%s, %s%s%s%s %d", logfont->lfFaceName, [m + is_bold?"Bold ":"", [m +[1mdiff --git a/iup/src/win/iupwin_fontdlg.c b/iup/src/win/iupwin_fontdlg.c[m +[1mindex 0602441..ce27cf2 100755[m +[1m--- a/iup/src/win/iupwin_fontdlg.c[m +[1m+++ b/iup/src/win/iupwin_fontdlg.c[m +[36m@@ -68,7 +68,7 @@[m [mstatic int winFontDlgPopup(Ihandle* ih, int x, int y)[m + [m + standardfont = iupAttribGet(ih, "VALUE");[m + if (!standardfont)[m +[31m- return IUP_ERROR;[m +[32m+[m[32m standardfont = IupGetGlobal("DEFAULTFONT");[m + [m + /* parse the old format first */[m + if (!iupFontParseWin(standardfont, typeface, &height, &is_bold, &is_italic, &is_underline, &is_strikeout))[m +[36m@@ -81,7 +81,7 @@[m [mstatic int winFontDlgPopup(Ihandle* ih, int x, int y)[m + if (height < 0)[m + height_pixels = height; /* already in pixels */[m + else[m +[31m- height_pixels = -IUPWIN_PT2PIXEL(height, res);[m +[32m+[m[32m height_pixels = -iupWIN_PT2PIXEL(height, res);[m + [m + if (height_pixels == 0)[m + return IUP_ERROR;[m +[36m@@ -134,7 +134,7 @@[m [mstatic int winFontDlgPopup(Ihandle* ih, int x, int y)[m + if (height < 0) /* not an error, use old value as a reference for the units */[m + height = height_pixels; /* return in pixels */[m + else[m +[31m- height = IUPWIN_PIXEL2PT(-height_pixels, res); /* return in points */[m +[32m+[m[32m height = iupWIN_PIXEL2PT(-height_pixels, res); /* return in points */[m + [m + iupAttribSetStrf(ih, "VALUE", "%s, %s%s%s%s %d", logfont.lfFaceName, [m + is_bold?"Bold ":"", [m +[1mdiff --git a/iup/src/win/iupwin_frame.c b/iup/src/win/iupwin_frame.c[m +[1mindex 0949b5d..3f56aed 100755[m +[1m--- a/iup/src/win/iupwin_frame.c[m +[1m+++ b/iup/src/win/iupwin_frame.c[m +[36m@@ -47,6 +47,27 @@[m [mvoid iupdrvFrameGetDecorOffset(Ihandle* ih, int *x, int *y)[m + }[m + }[m + [m +[32m+[m[32mstatic char* winFrameGetBgColorAttrib(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR"))[m +[32m+[m[32m return NULL;[m +[32m+[m[32m else[m +[32m+[m[32m return iupBaseNativeParentGetBgColorAttrib(ih);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic int winFrameSetBgColorAttrib(Ihandle* ih, const char* value)[m +[32m+[m[32m{[m +[32m+[m[32m (void)value;[m +[32m+[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR"))[m +[32m+[m[32m {[m +[32m+[m[32m IupUpdate(ih); /* post a redraw */[m +[32m+[m[32m return 1;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m return 0;[m +[32m+[m[32m}[m +[32m+[m + static void winFrameDrawText(HDC hDC, const char* text, int x, int y, COLORREF fgcolor)[m + {[m + COLORREF oldcolor;[m +[36m@@ -126,6 +147,16 @@[m [mstatic void winFrameDrawItem(Ihandle* ih, DRAWITEMSTRUCT *drawitem)[m + DrawEdge(hDC, &drawitem->rcItem, EDGE_SUNKEN, BF_RECT);[m + else[m + DrawEdge(hDC, &drawitem->rcItem, EDGE_ETCHED, BF_RECT);[m +[32m+[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR"))[m +[32m+[m[32m {[m +[32m+[m[32m unsigned char r=0, g=0, b=0;[m +[32m+[m[32m char* color = iupAttribGetStr(ih, "BGCOLOR");[m +[32m+[m[32m iupStrToRGB(color, &r, &g, &b);[m +[32m+[m[32m SetDCBrushColor(hDC, RGB(r,g,b));[m +[32m+[m[32m InflateRect(&drawitem->rcItem, -2, -2);[m +[32m+[m[32m FillRect(hDC, &drawitem->rcItem, (HBRUSH)GetStockObject(DC_BRUSH));[m +[32m+[m[32m }[m + }[m + [m + iupwinDrawDestroyBitmapDC(&bmpDC);[m +[36m@@ -169,11 +200,13 @@[m [mstatic int winFrameMapMethod(Ihandle* ih)[m + title = iupAttribGet(ih, "TITLE");[m + if (title)[m + iupAttribSetStr(ih, "_IUPFRAME_HAS_TITLE", "1");[m +[31m-[m +[31m- if (iupAttribGetBoolean(IupGetDialog(ih), "COMPOSITED"))[m +[31m- dwExStyle |= WS_EX_COMPOSITED;[m + else[m +[31m- dwStyle |= WS_CLIPCHILDREN;[m +[32m+[m[32m {[m +[32m+[m[32m if (iupAttribGet(ih, "BGCOLOR"))[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPFRAME_HAS_BGCOLOR", "1");[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle);[m + [m + if (!iupwinCreateWindowEx(ih, "BUTTON", dwExStyle, dwStyle))[m + return IUP_ERROR;[m +[36m@@ -195,7 +228,7 @@[m [mvoid iupdrvFrameInitClass(Iclass* ic)[m + /* Driver Dependent Attribute functions */[m + [m + /* Visual */[m +[31m- iupClassRegisterAttribute(ic, "BGCOLOR", iupBaseNativeParentGetBgColorAttrib, NULL, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT); [m +[32m+[m[32m iupClassRegisterAttribute(ic, "BGCOLOR", winFrameGetBgColorAttrib, winFrameSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT);[m[41m [m + [m + /* Special */[m + iupClassRegisterAttribute(ic, "FGCOLOR", NULL, NULL, IUPAF_SAMEASSYSTEM, "DLGFGCOLOR", IUPAF_NOT_MAPPED);[m +[1mdiff --git a/iup/src/win/iupwin_globalattrib.c b/iup/src/win/iupwin_globalattrib.c[m +[1mindex a176925..bcd6355 100755[m +[1m--- a/iup/src/win/iupwin_globalattrib.c[m +[1m+++ b/iup/src/win/iupwin_globalattrib.c[m +[36m@@ -148,6 +148,11 @@[m [mint iupdrvSetGlobal(const char *name, const char *value)[m + winGlobalSendKey(key, 0x03);[m + return 0;[m + }[m +[32m+[m[32m if (iupStrEqual(name, "DLL_HINSTANCE"))[m +[32m+[m[32m {[m +[32m+[m[32m iupwin_dll_hinstance = (HINSTANCE)value;[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m + return 1;[m + }[m + [m +[36m@@ -239,5 +244,7 @@[m [mchar *iupdrvGetGlobal(const char *name)[m + return "YES";[m + return "NO";[m + }[m +[32m+[m[32m if (iupStrEqual(name, "DLL_HINSTANCE"))[m +[32m+[m[32m return (char*)iupwin_dll_hinstance;[m + return NULL;[m + }[m +[1mdiff --git a/iup/src/win/iupwin_info.c b/iup/src/win/iupwin_info.c[m +[1mindex 8ea7dd4..4d57289 100755[m +[1m--- a/iup/src/win/iupwin_info.c[m +[1m+++ b/iup/src/win/iupwin_info.c[m +[36m@@ -18,7 +18,7 @@[m + #include "iupwin_info.h"[m + [m + [m +[31m-int iupwinIsVista(void)[m +[32m+[m[32mint iupwinIsVistaOrNew(void)[m + {[m + OSVERSIONINFO osvi;[m + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);[m +[1mdiff --git a/iup/src/win/iupwin_info.h b/iup/src/win/iupwin_info.h[m +[1mindex d39bae0..8d461fb 100755[m +[1m--- a/iup/src/win/iupwin_info.h[m +[1m+++ b/iup/src/win/iupwin_info.h[m +[36m@@ -16,7 +16,7 @@[m [mint iupwinGetSystemMajorVersion(void);[m + int iupwinGetComCtl32Version(void);[m + char* iupwinGetSystemLanguage(void);[m + int iupwinIsAppThemed(void);[m +[31m-int iupwinIsVista(void);[m +[32m+[m[32mint iupwinIsVistaOrNew(void);[m + [m + /* color */[m + void iupwinGetSysColor(char* color, int wincolor);[m +[1mdiff --git a/iup/src/win/iupwin_key.c b/iup/src/win/iupwin_key.c[m +[1mindex 921ed94..899e837 100755[m +[1m--- a/iup/src/win/iupwin_key.c[m +[1m+++ b/iup/src/win/iupwin_key.c[m +[36m@@ -317,32 +317,32 @@[m [mint iupwinKeyEvent(Ihandle* ih, int wincode, int press)[m + void iupwinButtonKeySetStatus(WORD keys, char* status, int doubleclick)[m + {[m + if (keys & MK_SHIFT)[m +[31m- iupKEYSETSHIFT(status);[m +[32m+[m[32m iupKEY_SETSHIFT(status);[m + [m + if (keys & MK_CONTROL)[m +[31m- iupKEYSETCONTROL(status); [m +[32m+[m[32m iupKEY_SETCONTROL(status);[m[41m [m + [m + if (keys & MK_LBUTTON)[m +[31m- iupKEYSETBUTTON1(status);[m +[32m+[m[32m iupKEY_SETBUTTON1(status);[m + [m + if (keys & MK_MBUTTON)[m +[31m- iupKEYSETBUTTON2(status);[m +[32m+[m[32m iupKEY_SETBUTTON2(status);[m + [m + if (keys & MK_RBUTTON)[m +[31m- iupKEYSETBUTTON3(status);[m +[32m+[m[32m iupKEY_SETBUTTON3(status);[m + [m + if (doubleclick)[m +[31m- iupKEYSETDOUBLE(status);[m +[32m+[m[32m iupKEY_SETDOUBLE(status);[m + [m + if (GetKeyState(VK_MENU) & 0x8000)[m +[31m- iupKEYSETALT(status);[m +[32m+[m[32m iupKEY_SETALT(status);[m + [m + if ((GetKeyState(VK_LWIN) & 0x8000) || (GetKeyState(VK_RWIN) & 0x8000))[m +[31m- iupKEYSETSYS(status);[m +[32m+[m[32m iupKEY_SETSYS(status);[m + [m + if (keys & MK_XBUTTON1)[m +[31m- iupKEYSETBUTTON4(status);[m +[32m+[m[32m iupKEY_SETBUTTON4(status);[m + [m + if (keys & MK_XBUTTON2)[m +[31m- iupKEYSETBUTTON5(status);[m +[32m+[m[32m iupKEY_SETBUTTON5(status);[m + }[m +[1mdiff --git a/iup/src/win/iupwin_label.c b/iup/src/win/iupwin_label.c[m +[1mindex d5a1f53..95dd10c 100755[m +[1m--- a/iup/src/win/iupwin_label.c[m +[1m+++ b/iup/src/win/iupwin_label.c[m +[36m@@ -173,7 +173,7 @@[m [mstatic int winLabelSetAlignmentAttrib(Ihandle* ih, const char* value)[m + else /* "ATOP" */[m + ih->data->vert_alignment = IUP_ALIGN_ATOP;[m + [m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + return 0;[m + }[m +[36m@@ -197,7 +197,7 @@[m [mstatic int winLabelSetPaddingAttrib(Ihandle* ih, const char* value)[m + iupStrToIntInt(value, &ih->data->horiz_padding, &ih->data->vert_padding, 'x');[m + [m + if (ih->handle && ih->data->type != IUP_LABEL_SEP_HORIZ && ih->data->type != IUP_LABEL_SEP_VERT)[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + [m + return 0;[m + }[m +[36m@@ -211,7 +211,7 @@[m [mstatic int winLabelSetWordWrapAttrib(Ihandle* ih, const char* value)[m + else[m + ih->data->text_style &= ~DT_WORDBREAK;[m + [m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + [m + return 1;[m +[36m@@ -226,7 +226,7 @@[m [mstatic int winLabelSetEllipsisAttrib(Ihandle* ih, const char* value)[m + else[m + ih->data->text_style &= ~DT_END_ELLIPSIS;[m + [m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + [m + return 1;[m +[36m@@ -240,12 +240,24 @@[m [mstatic int winLabelSetFgColorAttrib(Ihandle* ih, const char* value)[m + if (iupStrToRGB(value, &r, &g, &b))[m + {[m + ih->data->fgcolor = RGB(r,g,b);[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m +[32m+[m[32m if (ih->handle)[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + }[m + return 1;[m + }[m + [m +[32m+[m[32mstatic int winLabelSetUpdateAttrib(Ihandle* ih, const char* value)[m +[32m+[m[32m{[m +[32m+[m[32m (void)value;[m +[32m+[m +[32m+[m[32m if (ih->handle)[m +[32m+[m[32m iupdrvPostRedraw(ih); /* Post a redraw */[m +[32m+[m +[32m+[m[32m return 1;[m +[32m+[m[32m}[m +[32m+[m + static int winLabelProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result)[m + {[m + switch (msg)[m +[36m@@ -257,6 +269,7 @@[m [mstatic int winLabelProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *re[m + *result = WVR_HREDRAW|WVR_VREDRAW;[m + return 1;[m + }[m +[32m+[m[32m break;[m + }[m + }[m + [m +[36m@@ -266,7 +279,7 @@[m [mstatic int winLabelProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *re[m + static int winLabelMapMethod(Ihandle* ih)[m + {[m + char* value;[m +[31m- DWORD dwStyle = WS_CHILD |[m +[32m+[m[32m DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS |[m + SS_NOTIFY; /* SS_NOTIFY is necessary because of the base messages */[m + [m + if (!ih->parent)[m +[36m@@ -330,7 +343,7 @@[m [mvoid iupdrvLabelInitClass(Iclass* ic)[m + [m + /* IupLabel only */[m + iupClassRegisterAttribute(ic, "ALIGNMENT", winLabelGetAlignmentAttrib, winLabelSetAlignmentAttrib, IUPAF_SAMEASSYSTEM, "ALEFT:ACENTER", IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttribute(ic, "IMAGE", NULL, NULL, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "IMAGE", NULL, winLabelSetUpdateAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "PADDING", iupLabelGetPaddingAttrib, winLabelSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED);[m + [m + /* IupLabel Windows and GTK only */[m +[1mdiff --git a/iup/src/win/iupwin_list.c b/iup/src/win/iupwin_list.c[m +[1mindex 8fdadb6..cb510b5 100755[m +[1m--- a/iup/src/win/iupwin_list.c[m +[1m+++ b/iup/src/win/iupwin_list.c[m +[36m@@ -154,6 +154,8 @@[m [mvoid iupdrvListInsertItem(Ihandle* ih, int pos, const char* value)[m + SendMessage(ih->handle, WIN_INSERTSTRING(ih), pos, (LPARAM)value);[m + SendMessage(ih->handle, WIN_SETITEMDATA(ih), pos, (LPARAM)iupdrvFontGetStringWidth(ih, value));[m + winListUpdateScrollWidth(ih);[m +[32m+[m +[32m+[m[32m iupListUpdateOldValue(ih, pos, 0);[m + }[m + [m + void iupdrvListRemoveItem(Ihandle* ih, int pos)[m +[36m@@ -164,8 +166,14 @@[m [mvoid iupdrvListRemoveItem(Ihandle* ih, int pos)[m + int curpos = SendMessage(ih->handle, WIN_GETCURSEL(ih), 0, 0);[m + if (pos == curpos)[m + {[m +[31m- if (curpos > 0) curpos--;[m +[31m- else curpos++;[m +[32m+[m[32m if (curpos > 0)[m[41m [m +[32m+[m[32m curpos--;[m +[32m+[m[32m else[m[41m [m +[32m+[m[32m {[m +[32m+[m[32m curpos=1;[m +[32m+[m[32m if (iupdrvListGetCount(ih)==1)[m +[32m+[m[32m curpos = -1; /* remove the selection */[m +[32m+[m[32m }[m + [m + SendMessage(ih->handle, WIN_SETCURSEL(ih), curpos, 0);[m + }[m +[36m@@ -173,6 +181,8 @@[m [mvoid iupdrvListRemoveItem(Ihandle* ih, int pos)[m + [m + SendMessage(ih->handle, WIN_DELETESTRING(ih), pos, 0L);[m + winListUpdateScrollWidth(ih);[m +[32m+[m +[32m+[m[32m iupListUpdateOldValue(ih, pos, 1);[m + }[m + [m + void iupdrvListRemoveAllItems(Ihandle* ih)[m +[36m@@ -220,18 +230,29 @@[m [mstatic void winListUpdateItemWidth(Ihandle* ih)[m + }[m + }[m + [m +[32m+[m[32mstatic int winListSetBgColorAttrib(Ihandle *ih, const char *value)[m +[32m+[m[32m{[m +[32m+[m[32m (void)value;[m +[32m+[m[32m if (ih->handle)[m +[32m+[m[32m iupdrvPostRedraw(ih);[m +[32m+[m[32m return 1;[m +[32m+[m[32m}[m +[32m+[m + static int winListSetStandardFontAttrib(Ihandle* ih, const char* value)[m + {[m + iupdrvSetStandardFontAttrib(ih, value);[m +[31m- winListUpdateItemWidth(ih);[m +[31m- winListUpdateScrollWidth(ih);[m +[32m+[m[32m if (ih->handle)[m +[32m+[m[32m {[m +[32m+[m[32m winListUpdateItemWidth(ih);[m +[32m+[m[32m winListUpdateScrollWidth(ih);[m +[32m+[m[32m }[m + return 1;[m + }[m + [m + static char* winListGetIdValueAttrib(Ihandle* ih, const char* name_id)[m + {[m + int pos = iupListGetPos(ih, name_id);[m +[31m- if (pos != -1)[m +[32m+[m[32m if (pos >= 0)[m + {[m + int len = SendMessage(ih->handle, WIN_GETTEXTLEN(ih), (WPARAM)pos, 0);[m + char* str = iupStrGetMemory(len+1);[m +[36m@@ -514,8 +535,10 @@[m [mstatic int winListSetNCAttrib(Ihandle* ih, const char* value)[m + {[m + HWND cbedit = (HWND)iupAttribGet(ih, "_IUPWIN_EDITBOX");[m + SendMessage(cbedit, EM_LIMITTEXT, ih->data->nc, 0L);[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int winListSetSelectionAttrib(Ihandle* ih, const char* value)[m +[36m@@ -995,13 +1018,27 @@[m [mstatic int winListEditProc(Ihandle* ih, HWND cbedit, UINT msg, WPARAM wp, LPARAM[m + if (msg==WM_KEYDOWN) /* process K_ANY before text callbacks */[m + {[m + ret = iupwinBaseProc(ih, msg, wp, lp, result);[m +[31m- if (ret) return 1;[m +[32m+[m[32m if (ret)[m[41m [m +[32m+[m[32m {[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPWIN_IGNORE_CHAR", "1");[m +[32m+[m[32m *result = 0;[m +[32m+[m[32m return 1;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPWIN_IGNORE_CHAR", NULL);[m + }[m + [m + switch (msg)[m + {[m + case WM_CHAR:[m + {[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPWIN_IGNORE_CHAR"))[m +[32m+[m[32m {[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPWIN_IGNORE_CHAR", NULL);[m +[32m+[m[32m *result = 0;[m +[32m+[m[32m return 1;[m +[32m+[m[32m }[m +[32m+[m + if ((char)wp == '\b')[m + { [m + if (!winListCallEditCb(ih, cbedit, NULL, 0, -1))[m +[36m@@ -1301,7 +1338,7 @@[m [mstatic void winListLayoutUpdateMethod(Ihandle *ih)[m + static int winListMapMethod(Ihandle* ih)[m + {[m + char* class_name;[m +[31m- DWORD dwStyle = WS_CHILD,[m +[32m+[m[32m DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS,[m + dwExStyle = WS_EX_CLIENTEDGE;[m + [m + if (!ih->parent)[m +[36m@@ -1426,7 +1463,7 @@[m [mvoid iupdrvListInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "STANDARDFONT", NULL, winListSetStandardFontAttrib, IUPAF_SAMEASSYSTEM, "DEFAULTFONT", IUPAF_NOT_MAPPED);[m + [m + /* Visual */[m +[31m- iupClassRegisterAttribute(ic, "BGCOLOR", NULL, NULL, IUPAF_SAMEASSYSTEM, "TXTBGCOLOR", IUPAF_NOT_MAPPED); [m +[32m+[m[32m iupClassRegisterAttribute(ic, "BGCOLOR", NULL, winListSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "TXTBGCOLOR", IUPAF_NOT_MAPPED);[m + [m + /* Special */[m + iupClassRegisterAttribute(ic, "FGCOLOR", NULL, NULL, IUPAF_SAMEASSYSTEM, "TXTFGCOLOR", IUPAF_NOT_MAPPED);[m +[1mdiff --git a/iup/src/win/iupwin_loop.c b/iup/src/win/iupwin_loop.c[m +[1mindex 7c5dbe7..fd25537 100755[m +[1m--- a/iup/src/win/iupwin_loop.c[m +[1m+++ b/iup/src/win/iupwin_loop.c[m +[36m@@ -106,6 +106,18 @@[m [mint IupMainLoop(void)[m + return IUP_NOERROR;[m + }[m + [m +[32m+[m[32mint IupLoopStepWait(void)[m +[32m+[m[32m{[m +[32m+[m[32m MSG msg;[m +[32m+[m[32m int ret = GetMessage(&msg, NULL, 0, 0);[m +[32m+[m[32m if (ret == -1) /* error */[m +[32m+[m[32m return IUP_ERROR;[m +[32m+[m[32m if (ret == 0 || /* WM_QUIT */[m +[32m+[m[32m winLoopProcessMessage(&msg) == IUP_CLOSE) /* ret != 0 */[m +[32m+[m[32m return IUP_CLOSE;[m +[32m+[m[32m return IUP_DEFAULT;[m +[32m+[m[32m}[m +[32m+[m + int IupLoopStep(void)[m + {[m + MSG msg;[m +[1mdiff --git a/iup/src/win/iupwin_menu.c b/iup/src/win/iupwin_menu.c[m +[1mindex 74a8b52..06ad93e 100755[m +[1m--- a/iup/src/win/iupwin_menu.c[m +[1m+++ b/iup/src/win/iupwin_menu.c[m +[36m@@ -385,7 +385,10 @@[m [mstatic int winMenuMapMethod(Ihandle* ih)[m + static void winMenuUnMapMethod(Ihandle* ih)[m + {[m + if (iupMenuIsMenuBar(ih))[m +[32m+[m[32m {[m + SetMenu(ih->parent->handle, NULL);[m +[32m+[m[32m ih->parent = NULL;[m +[32m+[m[32m }[m + [m + DestroyMenu((HMENU)ih->handle); /* DestroyMenu is recursive */[m + }[m +[1mdiff --git a/iup/src/win/iupwin_open.c b/iup/src/win/iupwin_open.c[m +[1mindex 7357cde..3629ce4 100755[m +[1m--- a/iup/src/win/iupwin_open.c[m +[1m+++ b/iup/src/win/iupwin_open.c[m +[36m@@ -76,8 +76,9 @@[m [mint iupdrvOpen(int *argc, char ***argv)[m + iupwin_hinstance = GetModuleHandle(NULL);[m + IupSetGlobal("HINSTANCE", (char*)iupwin_hinstance);[m + }[m +[31m-[m +[31m- CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);[m +[32m+[m[41m [m +[32m+[m[32m if (CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)==RPC_E_CHANGED_MODE)[m +[32m+[m[32m IupSetGlobal("_IUPWIN_COINIT_MULTITHREADED", "1");[m + [m + {[m + INITCOMMONCONTROLSEX InitCtrls;[m +[1mdiff --git a/iup/src/win/iupwin_progressbar.c b/iup/src/win/iupwin_progressbar.c[m +[1mindex 9038d79..4a52cc4 100755[m +[1m--- a/iup/src/win/iupwin_progressbar.c[m +[1m+++ b/iup/src/win/iupwin_progressbar.c[m +[36m@@ -106,7 +106,7 @@[m [mstatic int winProgressBarSetFgColorAttrib(Ihandle* ih, const char* value)[m + [m + static int winProgressBarMapMethod(Ihandle* ih)[m + {[m +[31m- DWORD dwStyle = WS_CHILD;[m +[32m+[m[32m DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS;[m + [m + if (!ih->parent)[m + return IUP_ERROR;[m +[1mdiff --git a/iup/src/win/iupwin_tabs.c b/iup/src/win/iupwin_tabs.c[m +[1mindex 682f451..b39f7fe 100755[m +[1m--- a/iup/src/win/iupwin_tabs.c[m +[1m+++ b/iup/src/win/iupwin_tabs.c[m +[36m@@ -232,10 +232,7 @@[m [mstatic HWND winTabCreatePageWindow(Ihandle* ih)[m + DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS, [m + dwExStyle = 0;[m + [m +[31m- if (iupAttribGetBoolean(IupGetDialog(ih), "COMPOSITED"))[m +[31m- dwExStyle |= WS_EX_COMPOSITED;[m +[31m- else[m +[31m- dwStyle |= WS_CLIPCHILDREN;[m +[32m+[m[32m iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle);[m + [m + hWnd = CreateWindowEx(dwExStyle, "IupTabsPage", NULL, dwStyle, [m + 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, [m +[36m@@ -255,9 +252,12 @@[m [mstatic int winTabsSetPaddingAttrib(Ihandle* ih, const char* value)[m + iupStrToIntInt(value, &ih->data->horiz_padding, &ih->data->vert_padding, 'x');[m + [m + if (ih->handle)[m +[32m+[m[32m {[m + SendMessage(ih->handle, TCM_SETPADDING, 0, MAKELPARAM(ih->data->horiz_padding, ih->data->vert_padding));[m +[31m-[m +[31m- return 0;[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int winTabsSetMultilineAttrib(Ihandle* ih, const char* value)[m +[36m@@ -368,6 +368,13 @@[m [mstatic char* winTabsGetBgColorAttrib(Ihandle* ih)[m + return IupGetGlobal("DLGBGCOLOR");[m + }[m + [m +[32m+[m[32mstatic int winTabsSetBgColorAttrib(Ihandle *ih, const char *value)[m +[32m+[m[32m{[m +[32m+[m[32m (void)value;[m +[32m+[m[32m iupdrvPostRedraw(ih);[m +[32m+[m[32m return 1;[m +[32m+[m[32m}[m +[32m+[m + [m + /* ------------------------------------------------------------------------- */[m + /* winTabs - Calls the user callback to change of tab */[m +[36m@@ -397,6 +404,7 @@[m [mstatic int winTabsWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)[m + int prev_pos = SendMessage(ih->handle, TCM_GETCURSEL, 0, 0);[m + iupAttribSetInt(ih, "_IUPTABS_PREV_CHILD_POS", prev_pos);[m + [m +[32m+[m[32m /* save the previous handle if callback exists */[m + if (cb)[m + {[m + Ihandle* prev_child = IupGetChild(ih, prev_pos);[m +[36m@@ -420,7 +428,9 @@[m [mstatic int winTabsWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)[m + Ihandle* prev_child = (Ihandle*)iupAttribGet(ih, "_IUPTABS_PREV_CHILD");[m + iupAttribSetStr(ih, "_IUPTABS_PREV_CHILD", NULL);[m + [m +[31m- cb(ih, child, prev_child);[m +[32m+[m[32m /* avoid duplicate calls when a Tab is inside another Tab. */[m +[32m+[m[32m if (prev_child)[m +[32m+[m[32m cb(ih, child, prev_child);[m + }[m + }[m + [m +[36m@@ -522,7 +532,7 @@[m [mstatic void winTabsChildAddedMethod(Ihandle* ih, Ihandle* child)[m + }[m + }[m + [m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + }[m + }[m +[36m@@ -535,12 +545,11 @@[m [mstatic void winTabsChildRemovedMethod(Ihandle* ih, Ihandle* child)[m + if (tab_page)[m + {[m + int pos = winTabsGetPageWindowPos(ih, tab_page);[m +[32m+[m[32m iupTabsTestRemoveTab(ih, pos);[m +[32m+[m + SendMessage(ih->handle, TCM_DELETEITEM, pos, 0);[m + DestroyWindow(tab_page);[m + [m +[31m- if (pos==0) pos++;[m +[31m- iupdrvTabsSetCurrentTab(ih, pos-1);[m +[31m-[m + iupAttribSetStr(child, "_IUPTAB_CONTAINER", NULL);[m + }[m + }[m +[36m@@ -564,19 +573,14 @@[m [mstatic int winTabsMapMethod(Ihandle* ih)[m + if (ih->data->is_multiline)[m + dwStyle |= TCS_MULTILINE;[m + [m +[31m- if (iupAttribGetBoolean(IupGetDialog(ih), "COMPOSITED"))[m +[31m- {[m +[31m- dwExStyle |= WS_EX_COMPOSITED;[m +[32m+[m[32m iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle);[m + [m +[31m- if (!ih->data->is_multiline && iupwinIsVista())[m +[31m- {[m +[31m- /* workaround for composite bug in Vista */[m +[31m- ih->data->is_multiline = 1; [m +[31m- dwStyle |= TCS_MULTILINE;[m +[31m- }[m +[32m+[m[32m if (dwExStyle & WS_EX_COMPOSITED && !ih->data->is_multiline && iupwinIsVistaOrNew())[m +[32m+[m[32m {[m +[32m+[m[32m /* workaround for composite bug in Vista */[m +[32m+[m[32m ih->data->is_multiline = 1;[m[41m [m +[32m+[m[32m dwStyle |= TCS_MULTILINE;[m + }[m +[31m- else[m +[31m- dwStyle |= WS_CLIPCHILDREN;[m + [m + if (!iupwinCreateWindowEx(ih, WC_TABCONTROL, dwExStyle, dwStyle))[m + return IUP_ERROR;[m +[36m@@ -665,7 +669,7 @@[m [mvoid iupdrvTabsInitClass(Iclass* ic)[m + /* Driver Dependent Attribute functions */[m + [m + /* Visual */[m +[31m- iupClassRegisterAttribute(ic, "BGCOLOR", winTabsGetBgColorAttrib, NULL, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT); [m +[32m+[m[32m iupClassRegisterAttribute(ic, "BGCOLOR", winTabsGetBgColorAttrib, winTabsSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT);[m + [m + /* Special */[m + iupClassRegisterAttribute(ic, "FGCOLOR", NULL, NULL, IUPAF_SAMEASSYSTEM, "DLGFGCOLOR", IUPAF_NOT_MAPPED);[m +[36m@@ -676,5 +680,9 @@[m [mvoid iupdrvTabsInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "MULTILINE", winTabsGetMultilineAttrib, winTabsSetMultilineAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TABTITLE", NULL, winTabsSetTabTitleAttrib, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TABIMAGE", NULL, winTabsSetTabImageAttrib, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttribute(ic, "PADDING", iupTabsGetPaddingAttrib, winTabsSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "PADDING", iupTabsGetPaddingAttrib, winTabsSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m +[32m+[m[32m /* necessary because transparent background does not work when not using visual styles */[m +[32m+[m[32m if (!iupwin_comctl32ver6) /* Used by iupdrvImageCreateImage */[m +[32m+[m[32m iupClassRegisterAttribute(ic, "FLAT_ALPHA", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + }[m +[1mdiff --git a/iup/src/win/iupwin_text.c b/iup/src/win/iupwin_text.c[m +[1mindex dfe489a..2a61724 100755[m +[1m--- a/iup/src/win/iupwin_text.c[m +[1m+++ b/iup/src/win/iupwin_text.c[m +[36m@@ -432,8 +432,8 @@[m [mstatic int winTextSetLinColToPosition(Ihandle *ih, int lin, int col)[m + col--;[m + [m + linmax = SendMessage(ih->handle, EM_GETLINECOUNT, 0, 0L);[m +[31m- if (lin > linmax)[m +[31m- lin = linmax;[m +[32m+[m[32m if (lin > linmax-1)[m +[32m+[m[32m lin = linmax-1;[m + [m + lineindex = SendMessage(ih->handle, EM_LINEINDEX, (WPARAM)lin, 0L);[m + [m +[36m@@ -639,8 +639,12 @@[m [mstatic int winTextSetPaddingAttrib(Ihandle* ih, const char* value)[m + iupStrToIntInt(value, &(ih->data->horiz_padding), &(ih->data->vert_padding), 'x');[m + ih->data->vert_padding = 0;[m + if (ih->handle)[m +[32m+[m[32m {[m + SendMessage(ih->handle, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELPARAM(ih->data->horiz_padding, ih->data->horiz_padding));[m +[31m- return 0;[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int winTextSetSelectedTextAttrib(Ihandle* ih, const char* value)[m +[36m@@ -713,8 +717,11 @@[m [mstatic int winTextSetNCAttrib(Ihandle* ih, const char* value)[m + SendMessage(ih->handle, EM_EXLIMITTEXT, 0, ih->data->nc); /* so it can be larger than 64k */[m + else[m + SendMessage(ih->handle, EM_LIMITTEXT, ih->data->nc, 0L);[m +[32m+[m +[32m+[m[32m return 0;[m + }[m +[31m- return 0;[m +[32m+[m[32m else[m +[32m+[m[32m return 1; /* store until not mapped, when mapped will be set again */[m + }[m + [m + static int winTextSetSelectionAttrib(Ihandle* ih, const char* value)[m +[36m@@ -845,7 +852,7 @@[m [mstatic char* winTextGetSelectionPosAttrib(Ihandle* ih)[m + [m + static int winTextSetInsertAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + if (value)[m + {[m +[36m@@ -867,9 +874,9 @@[m [mstatic int winTextSetInsertAttrib(Ihandle* ih, const char* value)[m + [m + static int winTextSetAppendAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- int len;[m +[32m+[m[32m int pos;[m + char* str;[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + if (!value) value = "";[m + str = (char*)value;[m +[36m@@ -881,9 +888,9 @@[m [mstatic int winTextSetAppendAttrib(Ihandle* ih, const char* value)[m + str = iupStrToDos(str);[m + }[m + [m +[31m- len = GetWindowTextLength(ih->handle)+1;[m +[31m- SendMessage(ih->handle, EM_SETSEL, (WPARAM)len, (LPARAM)len);[m +[31m- if (ih->data->is_multiline && ih->data->append_newline)[m +[32m+[m[32m pos = GetWindowTextLength(ih->handle)+1;[m +[32m+[m[32m SendMessage(ih->handle, EM_SETSEL, (WPARAM)pos, (LPARAM)pos);[m +[32m+[m[32m if (ih->data->is_multiline && ih->data->append_newline && pos!=1)[m + {[m + if (ih->data->has_formatting)[m + SendMessage(ih->handle, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)"\r");[m +[36m@@ -920,7 +927,7 @@[m [mstatic int winTextSetTabSizeAttrib(Ihandle* ih, const char* value)[m + iupStrToInt(value, &tabsize);[m + tabsize *= 4;[m + SendMessage(ih->handle, EM_SETTABSTOPS, (WPARAM)1L, (LPARAM)&tabsize);[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + return 1;[m + }[m + [m +[36m@@ -1120,6 +1127,7 @@[m [mstatic int winTextSetBgColorAttrib(Ihandle *ih, const char *value)[m + SendMessage(ih->handle, EM_SETBKGNDCOLOR, 0, (LPARAM)color);[m + }[m + }[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + return 1;[m + }[m + [m +[36m@@ -1529,15 +1537,27 @@[m [mstatic int winTextProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res[m + ret = iupwinBaseProc(ih, msg, wp, lp, result);[m + if (ret) [m + {[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPWIN_IGNORE_CHAR", "1");[m + *result = 0;[m + return 1;[m + }[m +[32m+[m[32m else[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPWIN_IGNORE_CHAR", NULL);[m + }[m + [m + switch (msg)[m + {[m + case WM_CHAR:[m + {[m +[32m+[m[32m /* even aborting WM_KEYDOWN, a WM_CHAR will be sent, so ignore it also */[m +[32m+[m[32m /* if a dialog was shown, the loop will be processed, so ignore out of focus WM_CHAR messages */[m +[32m+[m[32m if (GetFocus() != ih->handle || iupAttribGet(ih, "_IUPWIN_IGNORE_CHAR"))[m +[32m+[m[32m {[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPWIN_IGNORE_CHAR", NULL);[m +[32m+[m[32m *result = 0;[m +[32m+[m[32m return 1;[m +[32m+[m[32m }[m +[32m+[m + if ((char)wp == '\b')[m + { [m + if (!winTextCallActionCb(ih, NULL, 0, -1))[m +[36m@@ -1736,7 +1756,7 @@[m [mstatic int winTextProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res[m + static void winTextCreateSpin(Ihandle* ih)[m + {[m + HWND hSpin;[m +[31m- DWORD dwStyle = WS_CHILD|UDS_ARROWKEYS|UDS_HOTTRACK|UDS_NOTHOUSANDS;[m +[32m+[m[32m DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS|UDS_ARROWKEYS|UDS_HOTTRACK|UDS_NOTHOUSANDS;[m + int serial = iupDialogGetChildId(ih);[m + [m + if (iupStrEqualNoCase(iupAttribGetStr(ih, "SPINALIGN"), "LEFT"))[m +[36m@@ -1826,7 +1846,7 @@[m [mstatic void winTextLayoutUpdateMethod(Ihandle* ih)[m + [m + static int winTextMapMethod(Ihandle* ih)[m + {[m +[31m- DWORD dwStyle = WS_CHILD, [m +[32m+[m[32m DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS,[m[41m [m + dwExStyle = 0;[m + char* winclass = "EDIT", *value;[m + [m +[36m@@ -1873,7 +1893,7 @@[m [mstatic int winTextMapMethod(Ihandle* ih)[m + }[m + else[m + {[m +[31m- dwStyle |= ES_AUTOHSCROLL|ES_NOHIDESEL;[m +[32m+[m[32m dwStyle |= ES_AUTOHSCROLL;[m + [m + if (iupAttribGetBoolean(ih, "PASSWORD"))[m + dwStyle |= ES_PASSWORD;[m +[36m@@ -1950,8 +1970,8 @@[m [mvoid iupdrvTextInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "STANDARDFONT", NULL, winTextSetStandardFontAttrib, IUPAF_SAMEASSYSTEM, "DEFAULTFONT", IUPAF_NOT_MAPPED);[m + [m + /* Overwrite Visual */[m +[31m- iupClassRegisterAttribute(ic, "BGCOLOR", NULL, winTextSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "TXTBGCOLOR", IUPAF_NOT_MAPPED); [m +[31m- iupClassRegisterAttribute(ic, "VISIBLE", iupBaseGetVisibleAttrib, winTextSetVisibleAttrib, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "BGCOLOR", NULL, winTextSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "TXTBGCOLOR", IUPAF_DEFAULT);[m[41m [m +[32m+[m[32m iupClassRegisterAttribute(ic, "VISIBLE", iupBaseGetVisibleAttrib, winTextSetVisibleAttrib, "YES", "NO", IUPAF_DEFAULT);[m + [m + /* Special */[m + iupClassRegisterAttribute(ic, "FGCOLOR", NULL, NULL, IUPAF_SAMEASSYSTEM, "TXTFGCOLOR", IUPAF_NOT_MAPPED); /* usually black */ [m +[1mdiff --git a/iup/src/win/iupwin_toggle.c b/iup/src/win/iupwin_toggle.c[m +[1mindex fcaa438..c17f594 100755[m +[1m--- a/iup/src/win/iupwin_toggle.c[m +[1m+++ b/iup/src/win/iupwin_toggle.c[m +[36m@@ -35,7 +35,9 @@[m + [m + void iupdrvToggleAddCheckBox(int *x, int *y)[m + {[m +[31m- (*x) += 16+6;[m +[32m+[m[32m (*x) += 16+8;[m +[32m+[m[32m if (!iupwin_comctl32ver6)[m +[32m+[m[32m (*x) += 4;[m + if ((*y) < 16) (*y) = 16; /* minimum height */[m + }[m + [m +[36m@@ -229,7 +231,7 @@[m [mstatic int winToggleSetImageAttrib(Ihandle* ih, const char* value)[m + iupAttribSetStr(ih, "IMAGE", (char*)value);[m + [m + if (iupwin_comctl32ver6)[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + else[m + {[m + int check = SendMessage(ih->handle, BM_GETCHECK, 0L, 0L);[m +[36m@@ -249,7 +251,7 @@[m [mstatic int winToggleSetImInactiveAttrib(Ihandle* ih, const char* value)[m + iupAttribSetStr(ih, "IMINACTIVE", (char*)value);[m + [m + if (iupwin_comctl32ver6)[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + else[m + {[m + int check = SendMessage(ih->handle, BM_GETCHECK, 0L, 0L);[m +[36m@@ -269,7 +271,7 @@[m [mstatic int winToggleSetImPressAttrib(Ihandle* ih, const char* value)[m + iupAttribSetStr(ih, "IMPRESS", (char*)value);[m + [m + if (iupwin_comctl32ver6)[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + else[m + {[m + int check = SendMessage(ih->handle, BM_GETCHECK, 0L, 0L);[m +[36m@@ -339,7 +341,7 @@[m [mstatic int winToggleSetActiveAttrib(Ihandle* ih, const char* value)[m + if (iupwin_comctl32ver6)[m + {[m + iupBaseSetActiveAttrib(ih, value);[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + return 0;[m + }[m + else[m +[36m@@ -382,11 +384,21 @@[m [mstatic int winToggleSetPaddingAttrib(Ihandle* ih, const char* value)[m + iupStrToIntInt(value, &ih->data->horiz_padding, &ih->data->vert_padding, 'x');[m + [m + if (ih->handle && iupwin_comctl32ver6 && ih->data->type == IUP_TOGGLE_IMAGE)[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + [m + return 0;[m + }[m + [m +[32m+[m[32mstatic int winToggleSetUpdateAttrib(Ihandle* ih, const char* value)[m +[32m+[m[32m{[m +[32m+[m[32m (void)value;[m +[32m+[m +[32m+[m[32m if (ih->handle)[m +[32m+[m[32m iupdrvPostRedraw(ih); /* Post a redraw */[m +[32m+[m +[32m+[m[32m return 1;[m +[32m+[m[32m}[m +[32m+[m + static int winToggleSetBgColorAttrib(Ihandle* ih, const char* value)[m + {[m + (void)value;[m +[36m@@ -395,7 +407,7 @@[m [mstatic int winToggleSetBgColorAttrib(Ihandle* ih, const char* value)[m + /* update internal image cache for controls that have the IMAGE attribute */[m + iupAttribSetStr(ih, "BGCOLOR", value);[m + iupImageUpdateParent(ih);[m +[31m- iupdrvDisplayRedraw(ih);[m +[32m+[m[32m iupdrvRedrawNow(ih);[m + }[m + return 1;[m + }[m +[36m@@ -591,7 +603,7 @@[m [mstatic int winToggleMapMethod(Ihandle* ih)[m + {[m + Ihandle* radio = iupRadioFindToggleParent(ih);[m + char* value;[m +[31m- DWORD dwStyle = WS_CHILD | [m +[32m+[m[32m DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS |[m + BS_NOTIFY; /* necessary because of the base messages */[m + [m + if (!ih->parent)[m +[36m@@ -673,11 +685,11 @@[m [mvoid iupdrvToggleInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "BGCOLOR", winToggleGetBgColorAttrib, winToggleSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT); [m + [m + /* Special */[m +[31m- iupClassRegisterAttribute(ic, "FGCOLOR", NULL, NULL, "DLGFGCOLOR", NULL, IUPAF_NOT_MAPPED); /* force the new default value */ [m +[32m+[m[32m iupClassRegisterAttribute(ic, "FGCOLOR", NULL, winToggleSetUpdateAttrib, "DLGFGCOLOR", NULL, IUPAF_NOT_MAPPED); /* force the new default value */[m[41m [m + iupClassRegisterAttribute(ic, "TITLE", iupdrvBaseGetTitleAttrib, winToggleSetTitleAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + [m + /* IupToggle only */[m +[31m- iupClassRegisterAttribute(ic, "ALIGNMENT", NULL, NULL, IUPAF_SAMEASSYSTEM, "ACENTER:ACENTER", IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "ALIGNMENT", NULL, winToggleSetUpdateAttrib, IUPAF_SAMEASSYSTEM, "ACENTER:ACENTER", IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "IMAGE", NULL, winToggleSetImageAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "IMINACTIVE", NULL, winToggleSetImInactiveAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "IMPRESS", NULL, winToggleSetImPressAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m +[1mdiff --git a/iup/src/win/iupwin_tree.c b/iup/src/win/iupwin_tree.c[m +[1mindex e6877dc..4a5f8be 100755[m +[1m--- a/iup/src/win/iupwin_tree.c[m +[1m+++ b/iup/src/win/iupwin_tree.c[m +[36m@@ -31,17 +31,19 @@[m + #include "iupwin_draw.h"[m + #include "iupwin_info.h"[m + [m +[32m+[m + typedef struct _winTreeItemData[m + {[m + COLORREF color;[m + unsigned char kind;[m +[31m- void* userdata;[m + HFONT hFont;[m + short image;[m + short image_expanded;[m + } winTreeItemData;[m + [m +[31m-#ifndef TVN_ITEMCHANGING /* Vista Only */[m +[32m+[m[32m/* Vista Only */[m +[32m+[m +[32m+[m[32m#ifndef TVN_ITEMCHANGING[m[41m [m + typedef struct tagNMTVITEMCHANGE {[m + NMHDR hdr;[m + UINT uChanged;[m +[36m@@ -54,257 +56,125 @@[m [mtypedef struct tagNMTVITEMCHANGE {[m + #define TVN_ITEMCHANGINGW (TVN_FIRST-17) [m + #endif[m + [m +[31m-static void winTreeSetFocusNode(Ihandle* ih, HTREEITEM hItem);[m +[31m-typedef int (*winTreeNodeFunc)(Ihandle* ih, HTREEITEM hItem, void* userdata);[m +[31m-[m +[31m-static int winTreeForEach(Ihandle* ih, HTREEITEM hItem, winTreeNodeFunc func, void* userdata)[m +[31m-{[m +[31m- HTREEITEM hItemChild;[m +[31m-[m +[31m- if (!hItem)[m +[31m- hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m +[32m+[m[32m#ifndef TVS_EX_DOUBLEBUFFER[m +[32m+[m[32m#define TVS_EX_DOUBLEBUFFER 0x0004[m +[32m+[m[32m#endif[m + [m +[31m- while(hItem != NULL)[m +[31m- {[m +[31m- if (!func(ih, hItem, userdata))[m +[31m- return 0;[m +[32m+[m[32m#ifndef TVM_SETEXTENDEDSTYLE[m +[32m+[m[32m#define TVM_SETEXTENDEDSTYLE (TV_FIRST + 44)[m +[32m+[m[32m#endif[m + [m +[31m- hItemChild = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m +[31m- if (hItemChild)[m +[31m- {[m +[31m- /* Recursively traverse child items */[m +[31m- if (!winTreeForEach(ih, hItemChild, func, userdata))[m +[31m- return 0;[m +[31m- }[m + [m +[31m- /* Go to next sibling item */[m +[31m- hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);[m +[31m- }[m +[32m+[m[32mstatic void winTreeSetFocusNode(Ihandle* ih, HTREEITEM hItem);[m + [m +[31m- return 1;[m +[31m-}[m + [m + /*****************************************************************************/[m + /* FINDING ITEMS */[m + /*****************************************************************************/[m +[31m-static HTREEITEM winTreeFindNodeID(Ihandle* ih, HTREEITEM hItem, HTREEITEM hNode)[m +[31m-{[m +[31m- TVITEM item;[m +[31m- winTreeItemData* itemData;[m +[31m-[m +[31m- while(hItem != NULL)[m +[31m- {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control++;[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(hItem == hNode)[m +[31m- return hItem;[m + [m +[31m- /* Get hItem attributes */[m +[31m- item.hItem = hItem;[m +[31m- item.mask = TVIF_HANDLE|TVIF_PARAM;[m +[31m- SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m +[31m- itemData = (winTreeItemData*)item.lParam;[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- if (itemData->kind == ITREE_BRANCH)[m +[31m- {[m +[31m- /* Recursively traverse child items */[m +[31m- HTREEITEM hItemChild = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m +[31m- hItemChild = winTreeFindNodeID(ih, hItemChild, hNode);[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(hItemChild)[m +[31m- return hItemChild;[m +[31m- }[m +[31m- /* Go to next sibling item */[m +[31m- hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);[m +[31m- }[m +[31m-[m +[31m- return NULL;[m +[32m+[m[32mInodeHandle* iupdrvTreeGetFocusNode(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m return (InodeHandle*)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CARET, 0);[m + }[m + [m +[31m-static int winTreeGetNodeId(Ihandle* ih, HTREEITEM hItem)[m +[32m+[m[32mstatic HTREEITEM winTreeFindNodeXY(Ihandle* ih, int x, int y)[m + {[m +[31m- HTREEITEM hItemRoot = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m +[31m- ih->data->id_control = -1;[m +[31m- if (winTreeFindNodeID(ih, hItemRoot, hItem))[m +[31m- return ih->data->id_control;[m +[31m- else[m +[31m- return -1;[m +[32m+[m[32m TVHITTESTINFO info;[m +[32m+[m[32m info.pt.x = x;[m +[32m+[m[32m info.pt.y = y;[m +[32m+[m[32m return (HTREEITEM)SendMessage(ih->handle, TVM_HITTEST, 0, (LPARAM)(LPTVHITTESTINFO)&info);[m + }[m + [m +[31m-static HTREEITEM winTreeFindUserDataID(Ihandle* ih, HTREEITEM hItem, void* userdata)[m +[32m+[m[32mstatic HTREEITEM winTreeFindNodePointed(Ihandle* ih)[m + {[m +[31m- TVITEM item;[m +[31m- winTreeItemData* itemData;[m +[31m-[m +[31m- while(hItem != NULL)[m +[31m- {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control++;[m +[31m-[m +[31m- /* Get hItem attributes */[m +[31m- item.hItem = hItem;[m +[31m- item.mask = TVIF_HANDLE|TVIF_PARAM;[m +[31m- SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m +[31m- itemData = (winTreeItemData*)item.lParam;[m +[31m-[m +[31m- /* userdata founded! */[m +[31m- if(itemData->userdata == userdata)[m +[31m- return hItem;[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- if (itemData->kind == ITREE_BRANCH)[m +[31m- {[m +[31m- /* Recursively traverse child items */[m +[31m- HTREEITEM hItemChild = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m +[31m- hItemChild = winTreeFindUserDataID(ih, hItemChild, userdata);[m +[31m-[m +[31m- /* userdata founded! */[m +[31m- if (hItemChild)[m +[31m- return hItemChild;[m +[31m- }[m +[31m-[m +[31m- /* Go to next sibling item */[m +[31m- hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);[m +[31m- }[m +[31m-[m +[31m- return NULL;[m +[32m+[m[32m TVHITTESTINFO info;[m +[32m+[m[32m DWORD pos = GetMessagePos();[m +[32m+[m[32m info.pt.x = LOWORD(pos);[m +[32m+[m[32m info.pt.y = HIWORD(pos);[m +[32m+[m[32m ScreenToClient(ih->handle, &info.pt);[m +[32m+[m[32m return (HTREEITEM)SendMessage(ih->handle, TVM_HITTEST, 0, (LPARAM)(LPTVHITTESTINFO)&info);[m + }[m + [m +[31m-static int winTreeGetUserDataId(Ihandle* ih, void* userdata)[m +[32m+[m[32mint iupwinGetColor(const char* value, COLORREF *color)[m + {[m +[31m- HTREEITEM hItemRoot = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m +[31m- ih->data->id_control = -1;[m +[31m- if (winTreeFindUserDataID(ih, hItemRoot, userdata))[m +[31m- return ih->data->id_control;[m +[31m- else[m +[31m- return -1;[m +[32m+[m[32m unsigned char r, g, b;[m +[32m+[m[32m if (iupStrToRGB(value, &r, &g, &b))[m +[32m+[m[32m {[m +[32m+[m[32m *color = RGB(r,g,b);[m +[32m+[m[32m return 1;[m +[32m+[m[32m }[m +[32m+[m[32m return 0;[m + }[m + [m +[31m-static HTREEITEM winTreeFindNodeFromID(Ihandle* ih, HTREEITEM hItem)[m +[32m+[m[32mstatic void winTreeChildCountRec(Ihandle* ih, HTREEITEM hItem, int *count)[m + {[m +[31m- TVITEM item;[m +[31m- winTreeItemData* itemData;[m +[31m-[m +[32m+[m[32m hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m + while(hItem != NULL)[m + {[m +[31m- /* ID control to traverse items */[m +[31m- ih->data->id_control--;[m +[31m-[m +[31m- /* StateID founded! */[m +[31m- if(ih->data->id_control < 0)[m +[31m- return hItem;[m +[31m-[m +[31m- /* Get hItem attributes */[m +[31m- item.hItem = hItem;[m +[31m- item.mask = TVIF_HANDLE|TVIF_PARAM;[m +[31m- SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m +[31m- itemData = (winTreeItemData*)item.lParam;[m +[31m-[m +[31m- /* Check whether we have child items */[m +[31m- if (itemData->kind == ITREE_BRANCH)[m +[31m- {[m +[31m- /* Recursively traverse child items */[m +[31m- HTREEITEM hItemChild = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m +[31m- hItemChild = winTreeFindNodeFromID(ih, hItemChild);[m +[32m+[m[32m (*count)++;[m + [m +[31m- /* StateID founded! */[m +[31m- if(ih->data->id_control < 0)[m +[31m- return hItemChild;[m +[31m- }[m +[32m+[m[32m /* go recursive to children */[m +[32m+[m[32m winTreeChildCountRec(ih, hItem, count);[m + [m + /* Go to next sibling item */[m + hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);[m + }[m +[31m-[m +[31m- return hItem;[m + }[m + [m +[31m-static HTREEITEM winTreeFindNodeFromString(Ihandle* ih, const char* name_id)[m +[32m+[m[32mint iupdrvTreeTotalChildCount(Ihandle* ih, HTREEITEM hItem)[m + {[m +[31m- if (name_id[0])[m +[31m- {[m +[31m- HTREEITEM hRoot = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m +[31m- iupStrToInt(name_id, &ih->data->id_control);[m +[31m- return winTreeFindNodeFromID(ih, hRoot);[m +[31m- }[m +[31m- else[m +[31m- return (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CARET, 0);[m +[32m+[m[32m int count = 0;[m +[32m+[m[32m winTreeChildCountRec(ih, hItem, &count);[m +[32m+[m[32m return count;[m + }[m + [m +[31m-/* Recursively, find a new brother for the item[m +[31m- that will have its depth changed. Returns the new brother. */[m +[31m-static HTREEITEM winTreeFindNewBrother(Ihandle* ih, HTREEITEM hBrotherItem)[m +[32m+[m[32mstatic void winTreeChildRebuildCacheRec(Ihandle* ih, HTREEITEM hItem, int *id)[m + {[m +[31m- TVITEM item;[m +[31m- winTreeItemData* itemData;[m +[31m-[m +[31m- while(hBrotherItem != NULL)[m +[32m+[m[32m hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m +[32m+[m[32m while(hItem != NULL)[m + {[m +[31m- if(ih->data->id_control < 0)[m +[31m- return hBrotherItem;[m +[31m-[m +[31m- item.hItem = hBrotherItem;[m +[31m- item.mask = TVIF_HANDLE|TVIF_PARAM;[m +[31m- SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m +[31m- itemData = (winTreeItemData*)item.lParam;[m +[31m-[m +[31m- if (itemData->kind == ITREE_BRANCH)[m +[31m- {[m +[31m- HTREEITEM hItemChild;[m +[31m-[m +[31m- ih->data->id_control--;[m +[31m- hItemChild = winTreeFindNewBrother(ih, (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hBrotherItem));[m +[32m+[m[32m (*id)++;[m +[32m+[m[32m ih->data->node_cache[*id].node_handle = hItem;[m + [m +[31m- if(ih->data->id_control < 0)[m +[31m- return hItemChild;[m +[31m- }[m +[32m+[m[32m /* go recursive to children */[m +[32m+[m[32m winTreeChildRebuildCacheRec(ih, hItem, id);[m + [m +[31m- hBrotherItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hBrotherItem);[m +[32m+[m[32m /* Go to next sibling item */[m +[32m+[m[32m hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);[m + }[m +[31m-[m +[31m- return hBrotherItem;[m + }[m + [m +[31m-static HTREEITEM winTreeFindNodePointed(Ihandle* ih)[m +[32m+[m[32mstatic void winTreeRebuildNodeCache(Ihandle* ih, int id, HTREEITEM hItem)[m + {[m +[31m- TVHITTESTINFO info;[m +[31m- DWORD pos = GetMessagePos();[m +[31m- info.pt.x = LOWORD(pos);[m +[31m- info.pt.y = HIWORD(pos);[m +[31m-[m +[31m- ScreenToClient(ih->handle, &info.pt);[m +[31m- [m +[31m- return (HTREEITEM)SendMessage(ih->handle, TVM_HITTEST, 0, (LPARAM)(LPTVHITTESTINFO)&info);[m +[32m+[m[32m ih->data->node_cache[id].node_handle = hItem;[m +[32m+[m[32m winTreeChildRebuildCacheRec(ih, hItem, &id);[m + }[m + [m +[31m-int iupwinGetColor(const char* value, COLORREF *color)[m +[31m-{[m +[31m- unsigned char r, g, b;[m +[31m- if (iupStrToRGB(value, &r, &g, &b))[m +[31m- {[m +[31m- *color = RGB(r,g,b);[m +[31m- return 1;[m +[31m- }[m +[31m- return 0;[m +[31m-}[m + [m + /*****************************************************************************/[m + /* ADDING ITEMS */[m + /*****************************************************************************/[m +[32m+[m +[32m+[m[32mstatic void winTreeExpandItem(Ihandle* ih, HTREEITEM hItem, int expand);[m +[32m+[m + void iupdrvTreeAddNode(Ihandle* ih, const char* name_id, int kind, const char* title, int add)[m + {[m +[31m- TVITEM item, tviPrevItem;[m +[32m+[m[32m TVITEM item;[m + TVINSERTSTRUCT tvins;[m +[31m- HTREEITEM hPrevItem = winTreeFindNodeFromString(ih, name_id);[m +[31m- int kindPrev;[m +[32m+[m[32m HTREEITEM hPrevItem = iupTreeGetNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItemNew;[m + winTreeItemData* itemData;[m + [m + if (!hPrevItem)[m +[31m- return;[m +[32m+[m[32m {[m +[32m+[m[32m /* check if the root was really specified */[m +[32m+[m[32m int id = 0;[m +[32m+[m[32m if (!iupStrToInt(name_id, &id) || id != -1)[m +[32m+[m[32m return;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m if (!title)[m +[32m+[m[32m title = "";[m + [m + itemData = calloc(1, sizeof(winTreeItemData));[m + itemData->image = -1;[m +[36m@@ -318,83 +188,71 @@[m [mvoid iupdrvTreeAddNode(Ihandle* ih, const char* name_id, int kind, const char* t[m + iupwinGetColor(iupAttribGetStr(ih, "FGCOLOR"), &itemData->color);[m + [m + if (kind == ITREE_BRANCH)[m +[31m- {[m + item.iSelectedImage = item.iImage = (int)ih->data->def_image_collapsed;[m +[31m-[m +[31m- if (ih->data->add_expanded)[m +[31m- {[m +[31m- item.mask |= TVIF_STATE;[m +[31m- item.state = item.stateMask = TVIS_EXPANDED;[m +[31m- item.iSelectedImage = item.iImage = (int)ih->data->def_image_expanded;[m +[31m- }[m +[31m- }[m + else[m + item.iSelectedImage = item.iImage = (int)ih->data->def_image_leaf;[m + [m + /* Save the heading level in the node's application-defined data area */[m + tvins.item = item;[m + [m +[31m- /* get the KIND attribute of node selected */ [m +[31m- tviPrevItem.hItem = hPrevItem;[m +[31m- tviPrevItem.mask = TVIF_PARAM|TVIF_CHILDREN; [m +[31m- SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&tviPrevItem);[m +[31m- kindPrev = ((winTreeItemData*)tviPrevItem.lParam)->kind;[m +[31m-[m +[31m- /* Define the parent and the position to the new node inside[m +[31m- the list, using the KIND attribute of node selected */[m +[31m- if (kindPrev == ITREE_BRANCH && add)[m +[31m- {[m +[31m- tvins.hParent = hPrevItem;[m +[31m- tvins.hInsertAfter = TVI_FIRST; /* insert the new node after item selected, as first child */[m +[31m- }[m +[31m- else[m +[31m- {[m +[31m- tvins.hParent = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hPrevItem);[m +[31m- tvins.hInsertAfter = hPrevItem; /* insert the new node after item selected */[m +[31m- }[m +[31m-[m +[31m- /* Add the node to the tree-view control */[m +[31m- SendMessage(ih->handle, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);[m +[31m-[m +[31m- if (kindPrev == ITREE_BRANCH && tviPrevItem.cChildren==0)[m +[32m+[m[32m if (hPrevItem)[m + {[m +[31m- /* this is the first child, redraw to update the '+'/'-' buttons */[m +[31m- iupdrvDisplayRedraw(ih);[m +[31m- }[m +[31m-}[m +[32m+[m[32m int kindPrev;[m +[32m+[m[32m TVITEM tviPrevItem;[m + [m +[31m-static void winTreeAddRootNode(Ihandle* ih)[m +[31m-{[m +[31m- TVITEM item; [m +[31m- TVINSERTSTRUCT tvins;[m +[31m- HTREEITEM hNewItem;[m +[31m- winTreeItemData* itemData;[m +[32m+[m[32m /* get the KIND attribute of reference node */[m[41m [m +[32m+[m[32m tviPrevItem.hItem = hPrevItem;[m +[32m+[m[32m tviPrevItem.mask = TVIF_PARAM|TVIF_CHILDREN;[m[41m [m +[32m+[m[32m SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&tviPrevItem);[m +[32m+[m[32m kindPrev = ((winTreeItemData*)tviPrevItem.lParam)->kind;[m + [m +[31m- itemData = calloc(1, sizeof(winTreeItemData));[m +[31m- itemData->image = -1;[m +[31m- itemData->image_expanded = -1;[m +[31m- itemData->kind = ITREE_BRANCH;[m +[32m+[m[32m /* Define the parent and the position to the new node inside[m +[32m+[m[32m the list, using the KIND attribute of reference node */[m +[32m+[m[32m if (kindPrev == ITREE_BRANCH && add)[m +[32m+[m[32m {[m +[32m+[m[32m /* depth+1 */[m +[32m+[m[32m tvins.hParent = hPrevItem;[m +[32m+[m[32m tvins.hInsertAfter = TVI_FIRST; /* insert the new node after the reference node, as first child */[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m /* same depth */[m +[32m+[m[32m tvins.hParent = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hPrevItem);[m +[32m+[m[32m tvins.hInsertAfter = hPrevItem; /* insert the new node after reference node */[m +[32m+[m[32m }[m + [m +[31m- item.mask = TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; [m +[31m- item.state = item.stateMask = TVIS_EXPANDED;[m +[31m- item.iSelectedImage = item.iImage = (int)ih->data->def_image_expanded;[m +[31m- item.lParam = (LPARAM)itemData;[m +[32m+[m[32m /* Add the new node */[m +[32m+[m[32m hItemNew = (HTREEITEM)SendMessage(ih->handle, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);[m +[32m+[m[32m iupTreeAddToCache(ih, add, kindPrev, hPrevItem, hItemNew);[m + [m +[31m- iupwinGetColor(iupAttribGetStr(ih, "FGCOLOR"), &itemData->color);[m +[32m+[m[32m if (kindPrev == ITREE_BRANCH && tviPrevItem.cChildren==0) /* was 0, now is 1 */[m +[32m+[m[32m {[m +[32m+[m[32m /* this is the first child, redraw to update the '+'/'-' buttons */[m +[32m+[m[32m if (ih->data->add_expanded)[m +[32m+[m[32m winTreeExpandItem(ih, hPrevItem, 1);[m +[32m+[m[32m else[m +[32m+[m[32m winTreeExpandItem(ih, hPrevItem, 0);[m +[32m+[m[32m }[m + [m +[31m- /* Save the heading level in the node's application-defined data area */[m +[31m- tvins.item = item; [m +[31m- tvins.hInsertAfter = TVI_FIRST;[m +[31m- tvins.hParent = TVI_ROOT;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m tvins.hInsertAfter = TVI_FIRST;[m +[32m+[m[32m tvins.hParent = TVI_ROOT;[m + [m +[31m- /* Add the node to the tree-view control */[m +[31m- hNewItem = (HTREEITEM)SendMessage(ih->handle, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);[m +[32m+[m[32m /* Add the new node */[m +[32m+[m[32m hItemNew = (HTREEITEM)SendMessage(ih->handle, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);[m +[32m+[m[32m iupTreeAddToCache(ih, 0, 0, NULL, hItemNew);[m + [m +[31m- /* MarkStart node */[m +[31m- iupAttribSetStr(ih, "_IUPTREE_MARKSTART_NODE", (char*)hNewItem);[m +[32m+[m[32m if (ih->data->node_count == 1)[m +[32m+[m[32m {[m +[32m+[m[32m /* MarkStart node */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_MARKSTART_NODE", (char*)hItemNew);[m + [m +[31m- /* Set the default VALUE */[m +[31m- winTreeSetFocusNode(ih, hNewItem);[m +[32m+[m[32m /* Set the default VALUE */[m +[32m+[m[32m winTreeSetFocusNode(ih, hItemNew);[m +[32m+[m[32m }[m +[32m+[m[32m }[m + }[m + [m + static int winTreeIsItemExpanded(Ihandle* ih, HTREEITEM hItem)[m +[36m@@ -408,13 +266,28 @@[m [mstatic int winTreeIsItemExpanded(Ihandle* ih, HTREEITEM hItem)[m + [m + static void winTreeExpandItem(Ihandle* ih, HTREEITEM hItem, int expand)[m + {[m +[31m- if (expand == -1)[m +[31m- expand = !winTreeIsItemExpanded(ih, hItem); /* toggle */[m +[32m+[m[32m TVITEM item;[m +[32m+[m[32m winTreeItemData* itemData;[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_BRANCH_CB", "1");[m +[32m+[m[32m /* it only works if the branch has children */[m +[32m+[m[32m SendMessage(ih->handle, TVM_EXPAND, expand? TVE_EXPAND: TVE_COLLAPSE, (LPARAM)hItem);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_BRANCH_CB", NULL);[m +[32m+[m +[32m+[m[32m /* update image */[m +[32m+[m[32m item.hItem = hItem;[m +[32m+[m[32m item.mask = TVIF_HANDLE|TVIF_PARAM;[m +[32m+[m[32m SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m +[32m+[m[32m itemData = (winTreeItemData*)item.lParam;[m + [m + if (expand)[m +[31m- SendMessage(ih->handle, TVM_EXPAND, TVE_EXPAND, (LPARAM)hItem);[m +[32m+[m[32m item.iSelectedImage = item.iImage = (itemData->image_expanded!=-1)? itemData->image_expanded: (int)ih->data->def_image_expanded;[m + else[m +[31m- SendMessage(ih->handle, TVM_EXPAND, TVE_COLLAPSE, (LPARAM)hItem);[m +[32m+[m[32m item.iSelectedImage = item.iImage = (itemData->image!=-1)? itemData->image: (int)ih->data->def_image_collapsed;[m +[32m+[m +[32m+[m[32m item.hItem = hItem;[m +[32m+[m[32m item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;[m +[32m+[m[32m SendMessage(ih->handle, TVM_SETITEM, 0, (LPARAM)(LPTVITEM)&item);[m + }[m + [m + /*****************************************************************************/[m +[36m@@ -445,12 +318,12 @@[m [mstatic void winTreeExpandTree(Ihandle* ih, HTREEITEM hItem, int expand)[m + /* SELECTING ITEMS */[m + /*****************************************************************************/[m + [m +[31m-static int winTreeIsItemSelected(Ihandle* ih, HTREEITEM hItem)[m +[32m+[m[32mstatic int winTreeIsNodeSelected(Ihandle* ih, HTREEITEM hItem)[m + {[m + return ((SendMessage(ih->handle, TVM_GETITEMSTATE, (WPARAM)hItem, TVIS_SELECTED)) & TVIS_SELECTED)!=0;[m + }[m + [m +[31m-static void winTreeSelectItem(Ihandle* ih, HTREEITEM hItem, int select)[m +[32m+[m[32mstatic void winTreeSelectNode(Ihandle* ih, HTREEITEM hItem, int select)[m + {[m + TV_ITEM item;[m + item.mask = TVIF_STATE | TVIF_HANDLE;[m +[36m@@ -458,16 +331,13 @@[m [mstatic void winTreeSelectItem(Ihandle* ih, HTREEITEM hItem, int select)[m + item.hItem = hItem;[m + [m + if (select == -1)[m +[31m- select = !winTreeIsItemSelected(ih, hItem);[m +[32m+[m[32m select = !winTreeIsNodeSelected(ih, hItem); /* toggle */[m + [m + item.state = select ? TVIS_SELECTED : 0;[m + [m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m + SendMessage(ih->handle, TVM_SETITEM, 0, (LPARAM)&item);[m +[31m-}[m +[31m-[m +[31m-static HTREEITEM winTreeGetFocusNode(Ihandle* ih)[m +[31m-{[m +[31m- return (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CARET, 0);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + }[m + [m + /* ------------Comment from wxWidgets--------------------[m +[36m@@ -475,17 +345,17 @@[m [mstatic HTREEITEM winTreeGetFocusNode(Ihandle* ih)[m + item without changing anything else. */[m + static void winTreeSetFocusNode(Ihandle* ih, HTREEITEM hItem)[m + {[m +[31m- HTREEITEM hItemFocus = winTreeGetFocusNode(ih);[m +[32m+[m[32m HTREEITEM hItemFocus = iupdrvTreeGetFocusNode(ih);[m + if (hItem != hItemFocus)[m + {[m + /* remember the selection state of the item */[m +[31m- int wasSelected = winTreeIsItemSelected(ih, hItem);[m +[32m+[m[32m int wasSelected = winTreeIsNodeSelected(ih, hItem);[m + int wasFocusSelected = 0;[m + [m +[31m- if (iupwinIsVista())[m +[32m+[m[32m if (iupwinIsVistaOrNew() && iupwin_comctl32ver6)[m + iupAttribSetStr(ih, "_IUPTREE_ALLOW_CHANGE", (char*)hItem); /* Vista Only */[m + else[m +[31m- wasFocusSelected = hItemFocus && winTreeIsItemSelected(ih, hItemFocus);[m +[32m+[m[32m wasFocusSelected = hItemFocus && winTreeIsNodeSelected(ih, hItemFocus);[m + [m + iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m + [m +[36m@@ -493,58 +363,42 @@[m [mstatic void winTreeSetFocusNode(Ihandle* ih, HTREEITEM hItem)[m + {[m + /* prevent the tree from unselecting the old focus which it would do by default */[m + SendMessage(ih->handle, TVM_SELECTITEM, TVGN_CARET, (LPARAM)NULL); /* remove the focus */[m +[31m- winTreeSelectItem(ih, hItemFocus, 1); /* select again */[m +[32m+[m[32m winTreeSelectNode(ih, hItemFocus, 1); /* select again */[m + }[m + [m + SendMessage(ih->handle, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); /* set focus, selection, and unselect the previous focus */[m + [m + if (!wasSelected)[m +[31m- winTreeSelectItem(ih, hItem, 0); /* need to clear the selection if was not selected */[m +[32m+[m[32m winTreeSelectNode(ih, hItem, 0); /* need to clear the selection if was not selected */[m + [m + iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + iupAttribSetStr(ih, "_IUPTREE_ALLOW_CHANGE", NULL);[m + }[m + }[m + [m +[31m-typedef struct _winTreeRange{[m +[31m- HTREEITEM hItem1, hItem2;[m +[31m- char inside, clear;[m +[31m-}winTreeRange;[m +[31m-[m +[31m-static int winTreeSelectRangeFunc(Ihandle* ih, HTREEITEM hItem, winTreeRange* range)[m +[32m+[m[32mstatic void winTreeSelectRange(Ihandle* ih, HTREEITEM hItem1, HTREEITEM hItem2, int clear)[m + {[m +[31m- int end_range = 0;[m +[31m-[m +[31m- if (range->inside == 0) /* detect the range start */[m +[32m+[m[32m int i;[m +[32m+[m[32m int id1 = iupTreeFindNodeId(ih, hItem1);[m +[32m+[m[32m int id2 = iupTreeFindNodeId(ih, hItem2);[m +[32m+[m[32m if (id2 == -1) id2 = ih->data->node_count-1;[m +[32m+[m[32m if (id1 > id2)[m + {[m +[31m- if (range->hItem1 == hItem) range->inside=1;[m +[31m- else if (range->hItem2 == hItem) range->inside=1;[m +[32m+[m[32m int tmp = id1;[m +[32m+[m[32m id1 = id2;[m +[32m+[m[32m id2 = tmp;[m + }[m +[31m- else if (range->inside == 1) /* detect the range end */[m +[32m+[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m + {[m +[31m- if (range->hItem1 == hItem) end_range=1;[m +[31m- else if (range->hItem2 == hItem) end_range=1;[m +[32m+[m[32m if (i < id1 || i > id2)[m +[32m+[m[32m {[m +[32m+[m[32m if (clear)[m +[32m+[m[32m winTreeSelectNode(ih, ih->data->node_cache[i].node_handle, 0);[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m winTreeSelectNode(ih, ih->data->node_cache[i].node_handle, 1);[m + }[m +[31m-[m +[31m- if (range->inside == 1) /* if inside, select */[m +[31m- winTreeSelectItem(ih, hItem, 1);[m +[31m- else if (range->clear) /* if outside and clear, unselect */[m +[31m- winTreeSelectItem(ih, hItem, 0);[m +[31m-[m +[31m- if (end_range || (range->inside && range->hItem1==range->hItem2))[m +[31m- range->inside=-1; /* update after selecting the node */[m +[31m-[m +[31m- return 1;[m +[31m-}[m +[31m-[m +[31m-static void winTreeSelectRange(Ihandle* ih, HTREEITEM hItemFrom, HTREEITEM hItemTo, int clear)[m +[31m-{[m +[31m- winTreeRange range;[m +[31m- range.hItem1 = hItemFrom;[m +[31m- range.hItem2 = hItemTo;[m +[31m- range.inside = 0;[m +[31m- range.clear = (char)clear;[m +[31m- winTreeForEach(ih, NULL, (winTreeNodeFunc)winTreeSelectRangeFunc, &range);[m + }[m + [m + static void winTreeSelectAll(Ihandle* ih)[m +[36m@@ -558,9 +412,10 @@[m [mstatic void winTreeClearSelection(Ihandle* ih, HTREEITEM hItemExcept)[m + winTreeSelectRange(ih, hItemExcept, hItemExcept, 1);[m + }[m + [m +[31m-static int winTreeInvertSelectFunc(Ihandle* ih, HTREEITEM hItem, void* userdata)[m +[32m+[m[32mstatic int winTreeInvertSelectFunc(Ihandle* ih, HTREEITEM hItem, int id, void* userdata)[m + {[m +[31m- winTreeSelectItem(ih, hItem, -1);[m +[32m+[m[32m (void)id;[m +[32m+[m[32m winTreeSelectNode(ih, hItem, -1);[m + (void)userdata;[m + return 1;[m + }[m +[36m@@ -568,14 +423,11 @@[m [mstatic int winTreeInvertSelectFunc(Ihandle* ih, HTREEITEM hItem, void* userdata)[m + typedef struct _winTreeSelArray{[m + Iarray* markedArray;[m + char is_handle;[m +[31m- int id_control;[m + }winTreeSelArray;[m + [m +[31m-static int winTreeSelectedArrayFunc(Ihandle* ih, HTREEITEM hItem, winTreeSelArray* selarray)[m +[32m+[m[32mstatic int winTreeSelectedArrayFunc(Ihandle* ih, HTREEITEM hItem, int id, winTreeSelArray* selarray)[m + { [m +[31m- selarray->id_control++;[m +[31m-[m +[31m- if (winTreeIsItemSelected(ih, hItem))[m +[32m+[m[32m if (winTreeIsNodeSelected(ih, hItem))[m + {[m + if (selarray->is_handle)[m + {[m +[36m@@ -587,7 +439,7 @@[m [mstatic int winTreeSelectedArrayFunc(Ihandle* ih, HTREEITEM hItem, winTreeSelArra[m + {[m + int* intArrayData = (int*)iupArrayInc(selarray->markedArray);[m + int i = iupArrayCount(selarray->markedArray);[m +[31m- intArrayData[i-1] = selarray->id_control;[m +[32m+[m[32m intArrayData[i-1] = id;[m + }[m + }[m + [m +[36m@@ -599,10 +451,9 @@[m [mstatic Iarray* winTreeGetSelectedArray(Ihandle* ih)[m + Iarray* markedArray = iupArrayCreate(1, sizeof(HTREEITEM));[m + winTreeSelArray selarray;[m + selarray.markedArray = markedArray;[m +[31m- selarray.id_control = -1;[m + selarray.is_handle = 1;[m + [m +[31m- winTreeForEach(ih, NULL, (winTreeNodeFunc)winTreeSelectedArrayFunc, &selarray);[m +[32m+[m[32m iupTreeForEach(ih, (iupTreeNodeFunc)winTreeSelectedArrayFunc, &selarray);[m + [m + return markedArray;[m + }[m +[36m@@ -612,10 +463,9 @@[m [mstatic Iarray* winTreeGetSelectedArrayId(Ihandle* ih)[m + Iarray* markedArray = iupArrayCreate(1, sizeof(int));[m + winTreeSelArray selarray;[m + selarray.markedArray = markedArray;[m +[31m- selarray.id_control = -1;[m + selarray.is_handle = 0;[m + [m +[31m- winTreeForEach(ih, NULL, (winTreeNodeFunc)winTreeSelectedArrayFunc, &selarray);[m +[32m+[m[32m iupTreeForEach(ih, (iupTreeNodeFunc)winTreeSelectedArrayFunc, &selarray);[m + [m + return markedArray;[m + }[m +[36m@@ -625,7 +475,7 @@[m [mstatic Iarray* winTreeGetSelectedArrayId(Ihandle* ih)[m + /* COPYING ITEMS (Branches and its children) */[m + /*****************************************************************************/[m + /* Insert the copied item in a new location. Returns the new item. */[m +[31m-static HTREEITEM winTreeCopyItem(Ihandle* ih, HTREEITEM hItem, HTREEITEM hParent, HTREEITEM hPosition, int full_copy)[m +[32m+[m[32mstatic HTREEITEM winTreeCopyItem(Ihandle* ih, HTREEITEM hItem, HTREEITEM hParent, HTREEITEM hPosition, int is_copy)[m + {[m + TVITEM item; [m + TVINSERTSTRUCT tvins;[m +[36m@@ -637,34 +487,34 @@[m [mstatic HTREEITEM winTreeCopyItem(Ihandle* ih, HTREEITEM hItem, HTREEITEM hParent[m + item.cchTextMax = 255;[m + SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m + [m +[31m- if (full_copy) /* during a full copy the userdata reference is not copied */[m +[32m+[m[32m if (is_copy) /* during a copy the itemdata reference is not reused */[m + {[m + /* create a new one */[m + winTreeItemData* itemDataNew = malloc(sizeof(winTreeItemData));[m + memcpy(itemDataNew, (void*)item.lParam, sizeof(winTreeItemData));[m +[31m- itemDataNew->userdata = NULL;[m + item.lParam = (LPARAM)itemDataNew;[m + }[m + [m +[31m- /* Copy everything including user data reference */[m +[32m+[m[32m /* Copy everything including itemdata reference */[m + tvins.item = item; [m + tvins.hInsertAfter = hPosition;[m + tvins.hParent = hParent;[m + [m +[31m- /* Add the node to the tree-view control */[m +[32m+[m[32m /* Add the new node */[m +[32m+[m[32m ih->data->node_count++;[m + return (HTREEITEM)SendMessage(ih->handle, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);[m + }[m + [m +[31m-static void winTreeCopyChildren(Ihandle* ih, HTREEITEM hItemSrc, HTREEITEM hItemDst, int full_copy)[m +[32m+[m[32mstatic void winTreeCopyChildren(Ihandle* ih, HTREEITEM hItemSrc, HTREEITEM hItemDst, int is_copy)[m + {[m + HTREEITEM hChildSrc = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItemSrc);[m +[31m- HTREEITEM hNewItem = TVI_FIRST;[m +[32m+[m[32m HTREEITEM hItemNew = TVI_FIRST;[m + while (hChildSrc != NULL)[m + {[m +[31m- hNewItem = winTreeCopyItem(ih, hChildSrc, hItemDst, hNewItem, full_copy); /* Use the same order they where enumerated */[m +[32m+[m[32m hItemNew = winTreeCopyItem(ih, hChildSrc, hItemDst, hItemNew, is_copy); /* Use the same order they where enumerated */[m + [m + /* Recursively transfer all the items */[m +[31m- winTreeCopyChildren(ih, hChildSrc, hNewItem, full_copy); [m +[32m+[m[32m winTreeCopyChildren(ih, hChildSrc, hItemNew, is_copy);[m[41m [m + [m + /* Go to next sibling item */[m + hChildSrc = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hChildSrc);[m +[36m@@ -672,11 +522,18 @@[m [mstatic void winTreeCopyChildren(Ihandle* ih, HTREEITEM hItemSrc, HTREEITEM hItem[m + }[m + [m + /* Copies all items in a branch to a new location. Returns the new branch node. */[m +[31m-static HTREEITEM winTreeCopyNode(Ihandle* ih, HTREEITEM hItemSrc, HTREEITEM hItemDst, int full_copy)[m +[32m+[m[32mstatic HTREEITEM winTreeCopyMoveNode(Ihandle* ih, HTREEITEM hItemSrc, HTREEITEM hItemDst, int is_copy)[m + {[m +[31m- HTREEITEM hNewItem, hParent;[m +[32m+[m[32m HTREEITEM hItemNew, hParent;[m + TVITEM item;[m + winTreeItemData* itemDataDst;[m +[32m+[m[32m int id_new, count, id_src, id_dst;[m +[32m+[m +[32m+[m[32m int old_count = ih->data->node_count;[m +[32m+[m +[32m+[m[32m id_src = iupTreeFindNodeId(ih, hItemSrc);[m +[32m+[m[32m id_dst = iupTreeFindNodeId(ih, hItemDst);[m +[32m+[m[32m id_new = id_dst+1; /* contains the position for a copy operation */[m + [m + /* Get DST node attributes */[m + item.hItem = hItemDst;[m +[36m@@ -691,31 +548,64 @@[m [mstatic HTREEITEM winTreeCopyNode(Ihandle* ih, HTREEITEM hItemSrc, HTREEITEM hIte[m + hItemDst = TVI_FIRST;[m + }[m + else[m +[31m- { [m +[32m+[m[32m {[m[41m [m +[32m+[m[32m if (itemDataDst->kind == ITREE_BRANCH)[m +[32m+[m[32m {[m +[32m+[m[32m int child_count = iupdrvTreeTotalChildCount(ih, hItemDst);[m +[32m+[m[32m id_new += child_count;[m +[32m+[m[32m }[m +[32m+[m + /* copy as next brother of item or collapsed branch */[m + hParent = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItemDst);[m + }[m + [m +[31m- hNewItem = winTreeCopyItem(ih, hItemSrc, hParent, hItemDst, full_copy);[m +[32m+[m[32m /* move to the same place does nothing */[m +[32m+[m[32m if (!is_copy && id_new == id_src)[m +[32m+[m[32m return NULL;[m +[32m+[m +[32m+[m[32m hItemNew = winTreeCopyItem(ih, hItemSrc, hParent, hItemDst, is_copy);[m +[32m+[m +[32m+[m[32m winTreeCopyChildren(ih, hItemSrc, hItemNew, is_copy);[m +[32m+[m +[32m+[m[32m count = ih->data->node_count - old_count;[m +[32m+[m[32m iupTreeCopyMoveCache(ih, id_src, id_new, count, is_copy);[m +[32m+[m +[32m+[m[32m if (!is_copy)[m +[32m+[m[32m {[m +[32m+[m[32m /* Deleting the node (and its children) from the old position */[m +[32m+[m[32m /* do not delete the itemdata, we reuse the references in CopyNode */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m[32m SendMessage(ih->handle, TVM_DELETEITEM, 0, (LPARAM)hItemSrc);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + [m +[31m- winTreeCopyChildren(ih, hItemSrc, hNewItem, full_copy);[m +[32m+[m[32m /* restore count, because we remove src */[m +[32m+[m[32m ih->data->node_count = old_count;[m + [m +[31m- return hNewItem;[m +[32m+[m[32m /* compensate position for a move */[m +[32m+[m[32m if (id_new > id_src)[m +[32m+[m[32m id_new -= count;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m winTreeRebuildNodeCache(ih, id_new, hItemNew);[m +[32m+[m +[32m+[m[32m return hItemNew;[m + }[m + [m + /*****************************************************************************/[m + /* MANIPULATING IMAGES */[m + /*****************************************************************************/[m +[31m-static void winTreeUpdateImages(Ihandle* ih, HTREEITEM hItem, int mode)[m +[32m+[m[32mstatic void winTreeUpdateImages(Ihandle* ih, int mode)[m + {[m +[31m- HTREEITEM hItemChild;[m +[32m+[m[32m HTREEITEM hItem;[m + TVITEM item;[m + winTreeItemData* itemData;[m +[32m+[m[32m int i;[m + [m + /* called when one of the default images is changed */[m +[31m-[m +[31m- while(hItem != NULL)[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m + {[m +[32m+[m[32m hItem = ih->data->node_cache[i].node_handle;[m +[32m+[m + /* Get node attributes */[m + item.hItem = hItem;[m + item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;[m +[36m@@ -742,10 +632,6 @@[m [mstatic void winTreeUpdateImages(Ihandle* ih, HTREEITEM hItem, int mode)[m + SendMessage(ih->handle, TVM_SETITEM, 0, (LPARAM)(LPTVITEM)&item);[m + }[m + }[m +[31m-[m +[31m- /* Recursively traverse child items */[m +[31m- hItemChild = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m +[31m- winTreeUpdateImages(ih, hItemChild, mode);[m + }[m + else[m + {[m +[36m@@ -756,9 +642,6 @@[m [mstatic void winTreeUpdateImages(Ihandle* ih, HTREEITEM hItem, int mode)[m + SendMessage(ih->handle, TVM_SETITEM, 0, (LPARAM)(LPTVITEM)&item);[m + }[m + }[m +[31m-[m +[31m- /* Go to next sibling node */[m +[31m- hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem);[m + }[m + }[m + [m +[36m@@ -828,29 +711,57 @@[m [mstatic int winTreeCallBranchLeafCb(Ihandle* ih, HTREEITEM hItem)[m + [m + if (itemData->kind == ITREE_BRANCH)[m + {[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPTREE_IGNORE_BRANCH_CB"))[m +[32m+[m[32m return IUP_DEFAULT;[m +[32m+[m + if (item.state & TVIS_EXPANDED)[m + {[m + IFni cbBranchClose = (IFni)IupGetCallback(ih, "BRANCHCLOSE_CB");[m + if (cbBranchClose)[m +[31m- return cbBranchClose(ih, winTreeGetNodeId(ih, hItem));[m +[32m+[m[32m return cbBranchClose(ih, iupTreeFindNodeId(ih, hItem));[m + }[m + else[m + {[m + IFni cbBranchOpen = (IFni)IupGetCallback(ih, "BRANCHOPEN_CB");[m + if (cbBranchOpen)[m +[31m- return cbBranchOpen(ih, winTreeGetNodeId(ih, hItem));[m +[32m+[m[32m return cbBranchOpen(ih, iupTreeFindNodeId(ih, hItem));[m + }[m + }[m + else[m + {[m + IFni cbExecuteLeaf = (IFni)IupGetCallback(ih, "EXECUTELEAF_CB");[m + if (cbExecuteLeaf)[m +[31m- return cbExecuteLeaf(ih, winTreeGetNodeId(ih, hItem));[m +[32m+[m[32m return cbExecuteLeaf(ih, iupTreeFindNodeId(ih, hItem));[m + }[m + [m + return IUP_DEFAULT;[m + }[m + [m +[32m+[m[32mstatic void winTreeCallMultiUnSelectionCb(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m IFnIi cbMulti = (IFnIi)IupGetCallback(ih, "MULTIUNSELECTION_CB");[m +[32m+[m[32m IFnii cbSelec = (IFnii)IupGetCallback(ih, "SELECTION_CB");[m +[32m+[m[32m if (cbSelec || cbMulti)[m +[32m+[m[32m {[m +[32m+[m[32m Iarray* markedArray = winTreeGetSelectedArrayId(ih);[m +[32m+[m[32m int* id_hitem = (int*)iupArrayGetData(markedArray);[m +[32m+[m[32m int i, count = iupArrayCount(markedArray);[m +[32m+[m +[32m+[m[32m if (count > 1)[m +[32m+[m[32m {[m +[32m+[m[32m if (cbMulti)[m +[32m+[m[32m cbMulti(ih, id_hitem, iupArrayCount(markedArray));[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m for (i=0; i<count; i++)[m +[32m+[m[32m cbSelec(ih, id_hitem[i], 0);[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m iupArrayDestroy(markedArray);[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m + static void winTreeCallMultiSelectionCb(Ihandle* ih)[m + {[m + IFnIi cbMulti = (IFnIi)IupGetCallback(ih, "MULTISELECTION_CB");[m +[36m@@ -885,6 +796,8 @@[m [mstatic void winTreeCallSelectionCb(Ihandle* ih, int status, HTREEITEM hItem)[m + IFnii cbSelec = (IFnii)IupGetCallback(ih, "SELECTION_CB");[m + if (cbSelec)[m + {[m +[32m+[m[32m int id;[m +[32m+[m + if (ih->data->mark_mode == ITREE_MARK_MULTIPLE && IupGetCallback(ih,"MULTISELECTION_CB"))[m + {[m + if ((GetKeyState(VK_SHIFT) & 0x8000))[m +[36m@@ -894,7 +807,9 @@[m [mstatic void winTreeCallSelectionCb(Ihandle* ih, int status, HTREEITEM hItem)[m + if (iupAttribGet(ih, "_IUPTREE_IGNORE_SELECTION_CB"))[m + return;[m + [m +[31m- cbSelec(ih, winTreeGetNodeId(ih, hItem), status);[m +[32m+[m[32m id = iupTreeFindNodeId(ih, hItem);[m +[32m+[m[32m if (id != -1)[m +[32m+[m[32m cbSelec(ih, id, status);[m + }[m + }[m + [m +[36m@@ -911,8 +826,8 @@[m [mstatic int winTreeCallDragDropCb(Ihandle* ih, HTREEITEM hItemDrag, HTREEITEM hIt[m + [m + if (cbDragDrop)[m + {[m +[31m- int drag_id = winTreeGetNodeId(ih, hItemDrag);[m +[31m- int drop_id = winTreeGetNodeId(ih, hItemDrop);[m +[32m+[m[32m int drag_id = iupTreeFindNodeId(ih, hItemDrag);[m +[32m+[m[32m int drop_id = iupTreeFindNodeId(ih, hItemDrop);[m + return cbDragDrop(ih, drag_id, drop_id, is_shift, *is_ctrl);[m + }[m + [m +[36m@@ -929,8 +844,8 @@[m [mstatic int winTreeSetImageBranchExpandedAttrib(Ihandle* ih, const char* value)[m + {[m + ih->data->def_image_expanded = (void*)winTreeGetImageIndex(ih, value);[m + [m +[31m- /* Update all images, starting at root node */[m +[31m- winTreeUpdateImages(ih, (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0), ITREE_UPDATEIMAGE_EXPANDED);[m +[32m+[m[32m /* Update all images */[m +[32m+[m[32m winTreeUpdateImages(ih, ITREE_UPDATEIMAGE_EXPANDED);[m + [m + return 1;[m + }[m +[36m@@ -939,8 +854,8 @@[m [mstatic int winTreeSetImageBranchCollapsedAttrib(Ihandle* ih, const char* value)[m + {[m + ih->data->def_image_collapsed = (void*)winTreeGetImageIndex(ih, value);[m + [m +[31m- /* Update all images, starting at root node */[m +[31m- winTreeUpdateImages(ih, (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0), ITREE_UPDATEIMAGE_COLLAPSED);[m +[32m+[m[32m /* Update all images */[m +[32m+[m[32m winTreeUpdateImages(ih, ITREE_UPDATEIMAGE_COLLAPSED);[m + [m + return 1;[m + }[m +[36m@@ -949,8 +864,8 @@[m [mstatic int winTreeSetImageLeafAttrib(Ihandle* ih, const char* value)[m + {[m + ih->data->def_image_leaf = (void*)winTreeGetImageIndex(ih, value);[m + [m +[31m- /* Update all images, starting at root node */[m +[31m- winTreeUpdateImages(ih, (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0), ITREE_UPDATEIMAGE_LEAF);[m +[32m+[m[32m /* Update all images */[m +[32m+[m[32m winTreeUpdateImages(ih, ITREE_UPDATEIMAGE_LEAF);[m + [m + return 1;[m + }[m +[36m@@ -959,7 +874,7 @@[m [mstatic int winTreeSetImageExpandedAttrib(Ihandle* ih, const char* name_id, const[m + {[m + TVITEM item;[m + winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return 0;[m + [m +[36m@@ -986,7 +901,7 @@[m [mstatic int winTreeSetImageAttrib(Ihandle* ih, const char* name_id, const char* v[m + {[m + TVITEM item;[m + winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return 0;[m + [m +[36m@@ -1025,7 +940,7 @@[m [mstatic int winTreeSetImageAttrib(Ihandle* ih, const char* name_id, const char* v[m + [m + static int winTreeSetTopItemAttrib(Ihandle* ih, const char* value)[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, value);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, value);[m + if (hItem)[m + SendMessage(ih->handle, TVM_ENSUREVISIBLE, 0, (LPARAM)hItem);[m + return 0;[m +[36m@@ -1056,9 +971,8 @@[m [mstatic int winTreeSetSpacingAttrib(Ihandle* ih, const char* value)[m + static int winTreeSetExpandAllAttrib(Ihandle* ih, const char* value)[m + {[m + HTREEITEM hItemRoot = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m +[31m- HTREEITEM hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItemRoot); /* skip the root node that is always expanded */[m + int expand = iupStrBoolean(value);[m +[31m- winTreeExpandTree(ih, hItem, expand);[m +[32m+[m[32m winTreeExpandTree(ih, hItemRoot, expand);[m + return 0;[m + }[m + [m +[36m@@ -1131,7 +1045,7 @@[m [mstatic char* winTreeGetTitle(Ihandle* ih, HTREEITEM hItem)[m + [m + static char* winTreeGetTitleAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return NULL;[m + return winTreeGetTitle(ih, hItem);[m +[36m@@ -1140,10 +1054,13 @@[m [mstatic char* winTreeGetTitleAttrib(Ihandle* ih, const char* name_id)[m + static int winTreeSetTitleAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m + TVITEM item; [m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return 0;[m + [m +[32m+[m[32m if (!value)[m +[32m+[m[32m value = "";[m +[32m+[m + item.hItem = hItem;[m + item.mask = TVIF_HANDLE | TVIF_TEXT; [m + item.pszText = (char*)value;[m +[36m@@ -1151,60 +1068,11 @@[m [mstatic int winTreeSetTitleAttrib(Ihandle* ih, const char* name_id, const char* v[m + return 0;[m + }[m + [m +[31m-static char* winTreeGetFindUserDataAttrib(Ihandle* ih, const char* name_id)[m +[31m-{[m +[31m- int id;[m +[31m- char* str = (char*)(name_id+1); /* skip ':' */[m +[31m- void* userdata = NULL;[m +[31m- if (sscanf(str, "%p", &userdata)!=1)[m +[31m- return NULL;[m +[31m- id = winTreeGetUserDataId(ih, userdata);[m +[31m- if (id == -1)[m +[31m- return NULL;[m +[31m- str = iupStrGetMemory(16);[m +[31m- sprintf(str, "%d", id);[m +[31m- return str;[m +[31m-}[m +[31m-[m +[31m-static char* winTreeGetUserDataAttrib(Ihandle* ih, const char* name_id)[m +[31m-{[m +[31m- TVITEM item;[m +[31m- winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[31m- if (!hItem)[m +[31m- return NULL;[m +[31m-[m +[31m- item.hItem = hItem;[m +[31m- item.mask = TVIF_HANDLE | TVIF_PARAM;[m +[31m- SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m +[31m- itemData = (winTreeItemData*)item.lParam;[m +[31m-[m +[31m- return itemData->userdata;[m +[31m-}[m +[31m-[m +[31m-static int winTreeSetUserDataAttrib(Ihandle* ih, const char* name_id, const char* value)[m +[31m-{[m +[31m- TVITEM item; [m +[31m- winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[31m- if (!hItem)[m +[31m- return 0;[m +[31m-[m +[31m- item.hItem = hItem;[m +[31m- item.mask = TVIF_HANDLE | TVIF_PARAM;[m +[31m- SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m +[31m- itemData = (winTreeItemData*)item.lParam;[m +[31m-[m +[31m- itemData->userdata = (void*)value;[m +[31m-[m +[31m- return 0;[m +[31m-}[m +[31m-[m + static char* winTreeGetTitleFontAttrib(Ihandle* ih, const char* name_id)[m + {[m + TVITEM item;[m + winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return NULL;[m + [m +[36m@@ -1220,7 +1088,7 @@[m [mstatic int winTreeSetTitleFontAttrib(Ihandle* ih, const char* name_id, const cha[m + {[m + TVITEM item; [m + winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return 0;[m + [m +[36m@@ -1230,11 +1098,23 @@[m [mstatic int winTreeSetTitleFontAttrib(Ihandle* ih, const char* name_id, const cha[m + itemData = (winTreeItemData*)item.lParam;[m + [m + if (value)[m +[32m+[m[32m {[m + itemData->hFont = iupwinGetHFont(value);[m +[32m+[m[32m if (itemData->hFont)[m +[32m+[m[32m {[m +[32m+[m[32m TV_ITEM item;[m +[32m+[m[32m item.mask = TVIF_STATE | TVIF_HANDLE | TVIF_TEXT;[m +[32m+[m[32m item.stateMask = TVIS_BOLD;[m +[32m+[m[32m item.hItem = hItem;[m +[32m+[m[32m item.pszText = winTreeGetTitle(ih, hItem); /* reset text to resize item */[m +[32m+[m[32m item.state = (strstr(value, "Bold")||strstr(value, "BOLD"))? TVIS_BOLD: 0;[m +[32m+[m[32m SendMessage(ih->handle, TVM_SETITEM, 0, (LPARAM)&item);[m +[32m+[m[32m }[m +[32m+[m[32m }[m + else[m + itemData->hFont = NULL;[m + [m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + [m + return 0;[m + }[m +[36m@@ -1259,7 +1139,7 @@[m [mstatic char* winTreeGetStateAttrib(Ihandle* ih, const char* name_id)[m + {[m + TVITEM item;[m + winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return NULL;[m + [m +[36m@@ -1281,25 +1161,34 @@[m [mstatic char* winTreeGetStateAttrib(Ihandle* ih, const char* name_id)[m + [m + static int winTreeSetStateAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m TVITEM item;[m +[32m+[m[32m winTreeItemData* itemData;[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return 0;[m + [m +[31m- winTreeExpandItem(ih, hItem, iupStrEqualNoCase(value, "EXPANDED"));[m +[32m+[m[32m /* Get Children: branch or leaf */[m +[32m+[m[32m item.mask = TVIF_HANDLE|TVIF_PARAM;[m[41m [m +[32m+[m[32m item.hItem = hItem;[m +[32m+[m[32m SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m +[32m+[m[32m itemData = (winTreeItemData*)item.lParam;[m +[32m+[m +[32m+[m[32m if (itemData->kind == ITREE_BRANCH)[m +[32m+[m[32m winTreeExpandItem(ih, hItem, iupStrEqualNoCase(value, "EXPANDED"));[m +[32m+[m + return 0;[m + }[m + [m + static char* winTreeGetDepthAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[31m- HTREEITEM hItemRoot = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m +[31m- int depth = 0;[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m +[32m+[m[32m int depth = -1;[m + char* str;[m + [m +[31m- if (!hItem)[m +[32m+[m[32m if (!hItem)[m[41m [m + return NULL;[m + [m +[31m- while((hItemRoot != hItem) && (hItem != NULL))[m +[32m+[m[32m while(hItem != NULL)[m + {[m + hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem);[m + depth++;[m +[36m@@ -1314,12 +1203,13 @@[m [mstatic int winTreeSetMoveNodeAttrib(Ihandle* ih, const char* name_id, const char[m + {[m + HTREEITEM hItemDst, hParent, hItemSrc;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m +[31m- hItemSrc = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m +[32m+[m[32m hItemSrc = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItemSrc)[m + return 0;[m +[31m- hItemDst = winTreeFindNodeFromString(ih, value);[m +[32m+[m[32m hItemDst = iupTreeGetNodeFromString(ih, value);[m + if (!hItemDst)[m + return 0;[m + [m +[36m@@ -1332,11 +1222,8 @@[m [mstatic int winTreeSetMoveNodeAttrib(Ihandle* ih, const char* name_id, const char[m + return 0;[m + }[m + [m +[31m- /* Copying the node and its children to the new position */[m +[31m- winTreeCopyNode(ih, hItemSrc, hItemDst, 0); /* not a full copy, preserve user data */[m +[31m-[m +[31m- /* do not delete the user data, we copy the references in CopyNode */[m +[31m- SendMessage(ih->handle, TVM_DELETEITEM, 0, (LPARAM)hItemSrc);[m +[32m+[m[32m /* Move the node and its children to the new position */[m +[32m+[m[32m winTreeCopyMoveNode(ih, hItemSrc, hItemDst, 0);[m + [m + return 0;[m + }[m +[36m@@ -1345,12 +1232,13 @@[m [mstatic int winTreeSetCopyNodeAttrib(Ihandle* ih, const char* name_id, const char[m + {[m + HTREEITEM hItemDst, hParent, hItemSrc;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m +[31m- hItemSrc = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m +[32m+[m[32m hItemSrc = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItemSrc)[m + return 0;[m +[31m- hItemDst = winTreeFindNodeFromString(ih, value);[m +[32m+[m[32m hItemDst = iupTreeGetNodeFromString(ih, value);[m + if (!hItemDst)[m + return 0;[m + [m +[36m@@ -1363,8 +1251,8 @@[m [mstatic int winTreeSetCopyNodeAttrib(Ihandle* ih, const char* name_id, const char[m + return 0;[m + }[m + [m +[31m- /* Copying the node and its children to the new position */[m +[31m- winTreeCopyNode(ih, hItemSrc, hItemDst, 1);[m +[32m+[m[32m /* Copy the node and its children to the new position */[m +[32m+[m[32m winTreeCopyMoveNode(ih, hItemSrc, hItemDst, 1);[m + [m + return 0;[m + }[m +[36m@@ -1375,7 +1263,7 @@[m [mstatic char* winTreeGetColorAttrib(Ihandle* ih, const char* name_id)[m + char* str;[m + TVITEM item;[m + winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return NULL;[m + [m +[36m@@ -1398,7 +1286,7 @@[m [mstatic int winTreeSetColorAttrib(Ihandle* ih, const char* name_id, const char* v[m + unsigned char r, g, b;[m + TVITEM item;[m + winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return 0;[m + [m +[36m@@ -1410,7 +1298,7 @@[m [mstatic int winTreeSetColorAttrib(Ihandle* ih, const char* name_id, const char* v[m + if (iupStrToRGB(value, &r, &g, &b))[m + {[m + itemData->color = RGB(r,g,b);[m +[31m- iupdrvDisplayUpdate(ih);[m +[32m+[m[32m iupdrvPostRedraw(ih);[m + }[m + [m + return 0;[m +[36m@@ -1435,7 +1323,7 @@[m [mstatic char* winTreeGetChildCountAttrib(Ihandle* ih, const char* name_id)[m + {[m + int count;[m + char* str;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return NULL;[m + [m +[36m@@ -1454,18 +1342,11 @@[m [mstatic char* winTreeGetChildCountAttrib(Ihandle* ih, const char* name_id)[m + return str;[m + }[m + [m +[31m-static char* winTreeGetCountAttrib(Ihandle* ih)[m +[31m-{[m +[31m- char* str = iupStrGetMemory(10);[m +[31m- sprintf(str, "%d", (int)SendMessage(ih->handle, TVM_GETCOUNT, 0, 0));[m +[31m- return str;[m +[31m-}[m +[31m-[m + static char* winTreeGetKindAttrib(Ihandle* ih, const char* name_id)[m + {[m + TVITEM item; [m + winTreeItemData* itemData;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return NULL;[m + [m +[36m@@ -1483,7 +1364,7 @@[m [mstatic char* winTreeGetKindAttrib(Ihandle* ih, const char* name_id)[m + static char* winTreeGetParentAttrib(Ihandle* ih, const char* name_id)[m + {[m + char* str;[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return NULL;[m + [m +[36m@@ -1492,15 +1373,13 @@[m [mstatic char* winTreeGetParentAttrib(Ihandle* ih, const char* name_id)[m + return NULL;[m + [m + str = iupStrGetMemory(10);[m +[31m- sprintf(str, "%d", winTreeGetNodeId(ih, hItem));[m +[32m+[m[32m sprintf(str, "%d", iupTreeFindNodeId(ih, hItem));[m + return str;[m + }[m + [m +[31m-static void winTreeDelNodeData(Ihandle* ih, HTREEITEM hItem)[m +[32m+[m[32mstatic void winTreeRemoveItemData(Ihandle* ih, HTREEITEM hItem, IFns cb, int id)[m + {[m + TVITEM item; [m +[31m- HTREEITEM hChildItem;[m +[31m-[m + item.hItem = hItem;[m + item.mask = TVIF_HANDLE|TVIF_PARAM; [m + if (SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item))[m +[36m@@ -1508,81 +1387,153 @@[m [mstatic void winTreeDelNodeData(Ihandle* ih, HTREEITEM hItem)[m + winTreeItemData* itemData = (winTreeItemData*)item.lParam;[m + if (itemData)[m + {[m +[31m- IFnis cb = (IFnis)IupGetCallback(ih, "NODEREMOVED_CB");[m +[31m- if (cb) cb(ih, winTreeGetNodeId(ih, hItem), (char*)itemData->userdata);[m +[32m+[m[32m if (cb)[m[41m [m +[32m+[m[32m cb(ih, (char*)ih->data->node_cache[id].userdata);[m +[32m+[m + free(itemData);[m + item.lParam = (LPARAM)NULL;[m + SendMessage(ih->handle, TVM_SETITEM, 0, (LPARAM)(LPTVITEM)&item);[m + }[m + }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void winTreeRemoveNodeDataRec(Ihandle* ih, HTREEITEM hItem, IFns cb, int *id)[m +[32m+[m[32m{[m +[32m+[m[32m int old_id = *id;[m + [m +[31m- hChildItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m +[32m+[m[32m /* Check whether we have child items */[m +[32m+[m[32m /* remove from children first */[m +[32m+[m[32m HTREEITEM hChildItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m + while (hChildItem)[m + {[m +[31m- winTreeDelNodeData(ih, hChildItem);[m +[32m+[m[32m /* go recursive to children */[m +[32m+[m[32m winTreeRemoveNodeDataRec(ih, hChildItem, cb, id);[m +[32m+[m +[32m+[m[32m /* Go to next sibling item */[m + hChildItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hChildItem);[m + }[m +[32m+[m +[32m+[m[32m /* actually do it for the node */[m +[32m+[m[32m ih->data->node_count--;[m +[32m+[m[32m (*id)++;[m +[32m+[m +[32m+[m[32m winTreeRemoveItemData(ih, hItem, cb, old_id);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void winTreeRemoveNodeData(Ihandle* ih, HTREEITEM hItem, int call_cb)[m +[32m+[m[32m{[m +[32m+[m[32m IFns cb = call_cb? (IFns)IupGetCallback(ih, "NODEREMOVED_CB"): NULL;[m +[32m+[m[32m int old_count = ih->data->node_count;[m +[32m+[m[32m int id = iupTreeFindNodeId(ih, hItem);[m +[32m+[m[32m int old_id = id;[m +[32m+[m +[32m+[m[32m winTreeRemoveNodeDataRec(ih, hItem, cb, &id);[m +[32m+[m +[32m+[m[32m if (call_cb)[m +[32m+[m[32m iupTreeDelFromCache(ih, old_id, old_count-ih->data->node_count);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void winTreeRemoveAllNodeData(Ihandle* ih, int call_cb)[m +[32m+[m[32m{[m +[32m+[m[32m IFns cb = call_cb? (IFns)IupGetCallback(ih, "NODEREMOVED_CB"): NULL;[m +[32m+[m[32m int i, old_count = ih->data->node_count;[m +[32m+[m[32m HTREEITEM hItem;[m +[32m+[m +[32m+[m[32m for (i = 0; i < ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m hItem = ih->data->node_cache[i].node_handle;[m +[32m+[m[32m winTreeRemoveItemData(ih, hItem, cb, i);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m ih->data->node_count = 0;[m +[32m+[m +[32m+[m[32m if (call_cb)[m +[32m+[m[32m iupTreeDelFromCache(ih, 0, old_count);[m + }[m + [m + static int winTreeSetDelNodeAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m +[31m- if(iupStrEqualNoCase(value, "SELECTED")) /* selected here means the specified one */[m +[32m+[m[32m if (iupStrEqualNoCase(value, "ALL"))[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[31m- HTREEITEM hItemRoot = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m +[32m+[m[32m winTreeRemoveAllNodeData(ih, 1);[m + [m +[31m- /* the root node can't be deleted */[m +[31m- if(!hItem || hItem == hItemRoot)[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m[32m SendMessage(ih->handle, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m +[32m+[m[32m return 0;[m +[32m+[m[32m }[m +[32m+[m[32m if (iupStrEqualNoCase(value, "SELECTED")) /* selected here means the reference one */[m +[32m+[m[32m {[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m +[32m+[m[32m if(!hItem)[m + return 0;[m + [m +[31m- /* deleting the specified node (and it's children) */[m +[31m- winTreeDelNodeData(ih, hItem);[m +[32m+[m[32m /* deleting the reference node (and it's children) */[m +[32m+[m[32m winTreeRemoveNodeData(ih, hItem, 1);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m + SendMessage(ih->handle, TVM_DELETEITEM, 0, (LPARAM)hItem);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + [m + return 0;[m + }[m +[31m- else if(iupStrEqualNoCase(value, "CHILDREN")) /* children of the specified one */[m +[32m+[m[32m else if(iupStrEqualNoCase(value, "CHILDREN")) /* children of the reference node */[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + HTREEITEM hChildItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m + [m + if(!hItem)[m + return 0;[m + [m +[31m- /* deleting the selected node's children */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m +[32m+[m[32m /* deleting the reference node children */[m + while (hChildItem)[m + {[m +[31m- winTreeDelNodeData(ih, hChildItem);[m +[32m+[m[32m winTreeRemoveNodeData(ih, hChildItem, 1);[m + SendMessage(ih->handle, TVM_DELETEITEM, 0, (LPARAM)hChildItem);[m + hChildItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);[m + }[m + [m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + return 0;[m + }[m + else if(iupStrEqualNoCase(value, "MARKED"))[m + {[m +[31m- int i, count;[m +[31m- Iarray* markedArray;[m +[31m- HTREEITEM* hItemArrayData;[m +[31m- HTREEITEM hItemRoot = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m +[32m+[m[32m int i, del_focus = 0;[m +[32m+[m[32m HTREEITEM hItemFocus;[m + [m +[31m- /* Delete the array of marked nodes */[m +[31m- markedArray = winTreeGetSelectedArray(ih);[m +[31m- hItemArrayData = (HTREEITEM*)iupArrayGetData(markedArray);[m +[31m- count = iupArrayCount(markedArray);[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m[32m hItemFocus = iupdrvTreeGetFocusNode(ih);[m + [m +[31m- for(i = 0; i < count; i++)[m +[32m+[m[32m for(i = 1; i < ih->data->node_count; /* increment only if not removed */)[m + {[m +[31m- if (hItemArrayData[i] != hItemRoot) /* the root node can't be deleted */[m +[32m+[m[32m if (winTreeIsNodeSelected(ih, ih->data->node_cache[i].node_handle))[m + {[m +[31m- winTreeDelNodeData(ih, hItemArrayData[i]);[m +[31m- SendMessage(ih->handle, TVM_DELETEITEM, 0, (LPARAM)hItemArrayData[i]);[m +[32m+[m[32m HTREEITEM hItem = ih->data->node_cache[i].node_handle;[m +[32m+[m[32m if (hItemFocus == hItem)[m +[32m+[m[32m {[m +[32m+[m[32m del_focus = 1;[m +[32m+[m[32m i++;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m winTreeRemoveNodeData(ih, hItem, 1);[m +[32m+[m[32m SendMessage(ih->handle, TVM_DELETEITEM, 0, (LPARAM)hItem);[m +[32m+[m[32m }[m + }[m +[32m+[m[32m else[m +[32m+[m[32m i++;[m + }[m + [m +[31m- iupArrayDestroy(markedArray);[m +[32m+[m[32m if (del_focus)[m +[32m+[m[32m {[m +[32m+[m[32m winTreeRemoveNodeData(ih, hItemFocus, 1);[m +[32m+[m[32m SendMessage(ih->handle, TVM_DELETEITEM, 0, (LPARAM)hItemFocus);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + [m + return 0;[m + }[m +[36m@@ -1592,22 +1543,13 @@[m [mstatic int winTreeSetDelNodeAttrib(Ihandle* ih, const char* name_id, const char*[m + [m + static int winTreeSetRenameAttrib(Ihandle* ih, const char* value)[m + { [m +[31m- HTREEITEM hItemFocus = winTreeGetFocusNode(ih);[m + if (ih->data->show_rename)[m + {[m +[31m- IFni cbShowRename = (IFni)IupGetCallback(ih, "SHOWRENAME_CB");[m +[31m- if (cbShowRename)[m +[31m- cbShowRename(ih, winTreeGetNodeId(ih, hItemFocus));[m +[31m-[m +[32m+[m[32m HTREEITEM hItemFocus;[m + SetFocus(ih->handle); /* the tree must have focus to activate the edit */[m +[32m+[m[32m hItemFocus = iupdrvTreeGetFocusNode(ih);[m + SendMessage(ih->handle, TVM_EDITLABEL, 0, (LPARAM)hItemFocus);[m + }[m +[31m- else[m +[31m- {[m +[31m- IFnis cbRenameNode = (IFnis)IupGetCallback(ih, "RENAMENODE_CB");[m +[31m- if (cbRenameNode)[m +[31m- cbRenameNode(ih, winTreeGetNodeId(ih, hItemFocus), winTreeGetTitle(ih, hItemFocus)); [m +[31m- }[m + [m + (void)value;[m + return 0;[m +[36m@@ -1615,11 +1557,11 @@[m [mstatic int winTreeSetRenameAttrib(Ihandle* ih, const char* value)[m + [m + static char* winTreeGetMarkedAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return NULL;[m + [m +[31m- if (winTreeIsItemSelected(ih, hItem))[m +[32m+[m[32m if (winTreeIsNodeSelected(ih, hItem))[m + return "YES";[m + else [m + return "NO";[m +[36m@@ -1627,17 +1569,23 @@[m [mstatic char* winTreeGetMarkedAttrib(Ihandle* ih, const char* name_id)[m + [m + static int winTreeSetMarkedAttrib(Ihandle* ih, const char* name_id, const char* value)[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return 0;[m + [m +[31m- winTreeSelectItem(ih, hItem, iupStrBoolean(value));[m +[32m+[m[32m if (ih->data->mark_mode==ITREE_MARK_SINGLE)[m +[32m+[m[32m {[m +[32m+[m[32m HTREEITEM hItemFocus = iupdrvTreeGetFocusNode(ih);[m +[32m+[m[32m winTreeSelectNode(ih, hItemFocus, 0);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m winTreeSelectNode(ih, hItem, iupStrBoolean(value));[m + return 0;[m + }[m + [m + static int winTreeSetMarkStartAttrib(Ihandle* ih, const char* name_id)[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, name_id);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, name_id);[m + if (!hItem)[m + return 0;[m + [m +[36m@@ -1649,15 +1597,59 @@[m [mstatic int winTreeSetMarkStartAttrib(Ihandle* ih, const char* name_id)[m + static char* winTreeGetValueAttrib(Ihandle* ih)[m + {[m + char* str;[m +[31m- HTREEITEM hItemFocus = winTreeGetFocusNode(ih);[m +[32m+[m[32m HTREEITEM hItemFocus = iupdrvTreeGetFocusNode(ih);[m + if (!hItemFocus)[m +[31m- return "0"; /* default VALUE is root */[m +[32m+[m[32m {[m +[32m+[m[32m if (ih->data->node_count)[m +[32m+[m[32m return "0"; /* default VALUE is root */[m +[32m+[m[32m else[m +[32m+[m[32m return "-1";[m +[32m+[m[32m }[m + [m + str = iupStrGetMemory(16);[m +[31m- sprintf(str, "%d", winTreeGetNodeId(ih, hItemFocus));[m +[32m+[m[32m sprintf(str, "%d", iupTreeFindNodeId(ih, hItemFocus));[m +[32m+[m[32m return str;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic char* winTreeGetMarkedNodesAttrib(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m char* str = iupStrGetMemory(ih->data->node_count+1);[m +[32m+[m[32m int i;[m +[32m+[m +[32m+[m[32m for (i=0; i<ih->data->node_count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (winTreeIsNodeSelected(ih, ih->data->node_cache[i].node_handle))[m +[32m+[m[32m str[i] = '+';[m +[32m+[m[32m else[m +[32m+[m[32m str[i] = '-';[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m str[ih->data->node_count] = 0;[m + return str;[m + }[m + [m +[32m+[m[32mstatic int winTreeSetMarkedNodesAttrib(Ihandle* ih, const char* value)[m +[32m+[m[32m{[m +[32m+[m[32m int count, i;[m +[32m+[m +[32m+[m[32m if (ih->data->mark_mode==ITREE_MARK_SINGLE || !value)[m +[32m+[m[32m return 0;[m +[32m+[m +[32m+[m[32m count = strlen(value);[m +[32m+[m[32m if (count > ih->data->node_count)[m +[32m+[m[32m count = ih->data->node_count;[m +[32m+[m +[32m+[m[32m for (i=0; i<count; i++)[m +[32m+[m[32m {[m +[32m+[m[32m if (value[i] == '+')[m +[32m+[m[32m winTreeSelectNode(ih, ih->data->node_cache[i].node_handle, 1);[m +[32m+[m[32m else[m +[32m+[m[32m winTreeSelectNode(ih, ih->data->node_cache[i].node_handle, 0);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m return 0;[m +[32m+[m[32m}[m +[32m+[m + static int winTreeSetMarkAttrib(Ihandle* ih, const char* value)[m + {[m + if (ih->data->mark_mode==ITREE_MARK_SINGLE)[m +[36m@@ -1665,7 +1657,7 @@[m [mstatic int winTreeSetMarkAttrib(Ihandle* ih, const char* value)[m + [m + if(iupStrEqualNoCase(value, "BLOCK"))[m + {[m +[31m- HTREEITEM hItemFocus = winTreeGetFocusNode(ih);[m +[32m+[m[32m HTREEITEM hItemFocus = iupdrvTreeGetFocusNode(ih);[m + winTreeSelectRange(ih, (HTREEITEM)iupAttribGet(ih, "_IUPTREE_MARKSTART_NODE"), hItemFocus, 0);[m + }[m + else if(iupStrEqualNoCase(value, "CLEARALL"))[m +[36m@@ -1673,14 +1665,14 @@[m [mstatic int winTreeSetMarkAttrib(Ihandle* ih, const char* value)[m + else if(iupStrEqualNoCase(value, "MARKALL"))[m + winTreeSelectAll(ih);[m + else if(iupStrEqualNoCase(value, "INVERTALL")) /* INVERTALL *MUST* appear before INVERT, or else INVERTALL will never be called. */[m +[31m- winTreeForEach(ih, NULL, (winTreeNodeFunc)winTreeInvertSelectFunc, NULL);[m +[32m+[m[32m iupTreeForEach(ih, (iupTreeNodeFunc)winTreeInvertSelectFunc, NULL);[m + else if(iupStrEqualPartial(value, "INVERT")) /* iupStrEqualPartial allows the use of "INVERTid" form */[m + {[m +[31m- HTREEITEM hItem = winTreeFindNodeFromString(ih, &value[strlen("INVERT")]);[m +[32m+[m[32m HTREEITEM hItem = iupTreeGetNodeFromString(ih, &value[strlen("INVERT")]);[m + if (!hItem)[m + return 0;[m + [m +[31m- winTreeSelectItem(ih, hItem, -1); /* toggle */[m +[32m+[m[32m winTreeSelectNode(ih, hItem, -1); /* toggle */[m + }[m + else[m + {[m +[36m@@ -1690,10 +1682,10 @@[m [mstatic int winTreeSetMarkAttrib(Ihandle* ih, const char* value)[m + if (iupStrToStrStr(value, str1, str2, '-')!=2)[m + return 0;[m + [m +[31m- hItem1 = winTreeFindNodeFromString(ih, str1);[m +[32m+[m[32m hItem1 = iupTreeGetNodeFromString(ih, str1);[m + if (!hItem1) [m + return 0;[m +[31m- hItem2 = winTreeFindNodeFromString(ih, str2);[m +[32m+[m[32m hItem2 = iupTreeGetNodeFromString(ih, str2);[m + if (!hItem2) [m + return 0;[m + [m +[36m@@ -1711,9 +1703,9 @@[m [mstatic int winTreeSetValueAttrib(Ihandle* ih, const char* value)[m + if (winTreeSetMarkAttrib(ih, value))[m + return 0;[m + [m +[31m- hItemFocus = winTreeGetFocusNode(ih);[m +[32m+[m[32m hItemFocus = iupdrvTreeGetFocusNode(ih);[m + [m +[31m- if(iupStrEqualNoCase(value, "ROOT"))[m +[32m+[m[32m if(iupStrEqualNoCase(value, "ROOT") || iupStrEqualNoCase(value, "FIRST"))[m + hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m + else if(iupStrEqualNoCase(value, "LAST"))[m + hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0);[m +[36m@@ -1759,15 +1751,14 @@[m [mstatic int winTreeSetValueAttrib(Ihandle* ih, const char* value)[m + else if(iupStrEqualNoCase(value, "PREVIOUS"))[m + hItem = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItemFocus);[m + else[m +[31m- hItem = winTreeFindNodeFromString(ih, value);[m +[32m+[m[32m hItem = iupTreeGetNodeFromString(ih, value);[m + [m + if (hItem)[m + {[m + if (ih->data->mark_mode==ITREE_MARK_SINGLE)[m + {[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[31m- winTreeSelectItem(ih, hItem, 1);[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m +[32m+[m[32m winTreeSelectNode(ih, hItemFocus, 0);[m +[32m+[m[32m winTreeSelectNode(ih, hItem, 1);[m + }[m + winTreeSetFocusNode(ih, hItem);[m + }[m +[36m@@ -1832,27 +1823,60 @@[m [mstatic LRESULT CALLBACK winTreeEditWinProc(HWND hwnd, UINT msg, WPARAM wp, LPARA[m + return CallWindowProc(oldProc, hwnd, msg, wp, lp);[m + }[m + [m +[31m-static void winTreeDrag(Ihandle* ih, int x, int y)[m +[32m+[m[32mstatic void winTreeBeginDrag(Ihandle* ih, int x, int y)[m + {[m +[31m- HTREEITEM hItemDrop;[m +[32m+[m[32m HIMAGELIST dragImageList;[m +[32m+[m +[32m+[m[32m HTREEITEM hItemDrag = winTreeFindNodeXY(ih, x, y);[m +[32m+[m[32m if (!hItemDrag)[m +[32m+[m[32m return;[m +[32m+[m +[32m+[m[32m SendMessage(ih->handle, TVM_ENDEDITLABELNOW, TRUE, 0);[m +[32m+[m +[32m+[m[32m /* store the drag-and-drop item */[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_DRAGITEM", (char*)hItemDrag);[m + [m +[32m+[m[32m /* get the image list for dragging */[m +[32m+[m[32m dragImageList = (HIMAGELIST)SendMessage(ih->handle, TVM_CREATEDRAGIMAGE, 0, (LPARAM)hItemDrag);[m +[32m+[m[32m if (dragImageList)[m +[32m+[m[32m {[m +[32m+[m[32m POINT pt;[m +[32m+[m[32m ImageList_BeginDrag(dragImageList, 0, 0, 0);[m +[32m+[m +[32m+[m[32m pt.x = x;[m +[32m+[m[32m pt.y = y;[m +[32m+[m +[32m+[m[32m ClientToScreen(ih->handle, &pt);[m +[32m+[m[32m ImageList_DragEnter(NULL, pt.x, pt.y);[m +[32m+[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_DRAGIMAGELIST", (char*)dragImageList);[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m ShowCursor(FALSE);[m +[32m+[m[32m SetCapture(ih->handle); /* drag only inside the tree */[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void winTreeDrag(Ihandle* ih, int x, int y)[m +[32m+[m[32m{[m +[32m+[m[32m HTREEITEM hItemDrop = winTreeFindNodeXY(ih, x, y);[m +[32m+[m[32m HTREEITEM hItemDrag = (HTREEITEM)iupAttribGet(ih, "_IUPTREE_DRAGITEM");[m + HIMAGELIST dragImageList = (HIMAGELIST)iupAttribGet(ih, "_IUPTREE_DRAGIMAGELIST");[m +[32m+[m + if (dragImageList)[m + {[m +[31m- POINT pnt;[m +[31m- pnt.x = x;[m +[31m- pnt.y = y;[m +[31m- GetCursorPos(&pnt);[m +[31m- ClientToScreen(GetDesktopWindow(), &pnt) ;[m +[31m- ImageList_DragMove(pnt.x, pnt.y);[m +[32m+[m[32m POINT pt;[m +[32m+[m[32m pt.x = x;[m +[32m+[m[32m pt.y = y;[m +[32m+[m[32m ClientToScreen(ih->handle, &pt);[m +[32m+[m[32m ImageList_DragMove(pt.x, pt.y);[m + }[m + [m +[31m- if ((hItemDrop = winTreeFindNodePointed(ih)) != NULL)[m +[32m+[m[32m if (hItemDrop && hItemDrop!=hItemDrag)[m + {[m + if(dragImageList)[m + ImageList_DragShowNolock(FALSE);[m + [m +[31m- SendMessage(ih->handle, TVM_SELECTITEM, TVGN_DROPHILITE, (LPARAM)hItemDrop);[m +[32m+[m[32m SendMessage(ih->handle, TVM_SETINSERTMARK, TRUE, (LPARAM)hItemDrop);[m + [m + /* store the drop item to be executed */[m + iupAttribSetStr(ih, "_IUPTREE_DROPITEM", (char*)hItemDrop);[m +[36m@@ -1860,6 +1884,8 @@[m [mstatic void winTreeDrag(Ihandle* ih, int x, int y)[m + if(dragImageList)[m + ImageList_DragShowNolock(TRUE);[m + }[m +[32m+[m[32m else[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_DROPITEM", NULL);[m + }[m + [m + static void winTreeDrop(Ihandle* ih)[m +[36m@@ -1882,7 +1908,7 @@[m [mstatic void winTreeDrop(Ihandle* ih)[m + ShowCursor(TRUE);[m + [m + /* Remove drop target highlighting */[m +[31m- SendMessage(ih->handle, TVM_SELECTITEM, TVGN_DROPHILITE, (LPARAM)NULL);[m +[32m+[m[32m SendMessage(ih->handle, TVM_SETINSERTMARK, 0, (LPARAM)NULL);[m + [m + iupAttribSetStr(ih, "_IUPTREE_DRAGITEM", NULL);[m + iupAttribSetStr(ih, "_IUPTREE_DROPITEM", NULL);[m +[36m@@ -1901,16 +1927,12 @@[m [mstatic void winTreeDrop(Ihandle* ih)[m + [m + if (winTreeCallDragDropCb(ih, hItemDrag, hItemDrop, &is_ctrl) == IUP_CONTINUE)[m + {[m +[31m- /* Copy the dragged item to the new position. */[m +[31m- HTREEITEM hItemNew = winTreeCopyNode(ih, hItemDrag, hItemDrop, is_ctrl);[m +[31m-[m +[31m- if (!is_ctrl)[m +[31m- {[m +[31m- /* do not delete the user data, we copy the references in CopyNode */[m +[31m- SendMessage(ih->handle, TVM_DELETEITEM, 0, (LPARAM)hItemDrag);[m +[31m- }[m +[32m+[m[32m /* Copy or move the dragged item to the new position. */[m +[32m+[m[32m HTREEITEM hItemNew = winTreeCopyMoveNode(ih, hItemDrag, hItemDrop, is_ctrl);[m + [m +[31m- SendMessage(ih->handle, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItemNew); /* set focus and selection */[m +[32m+[m[32m /* Set focus and selection */[m +[32m+[m[32m if (hItemNew)[m +[32m+[m[32m SendMessage(ih->handle, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItemNew);[m[41m [m + }[m + } [m + [m +[36m@@ -1929,9 +1951,7 @@[m [mstatic void winTreeExtendSelect(Ihandle* ih, int x, int y)[m + hItemFirstSel = (HTREEITEM)iupAttribGet(ih, "_IUPTREE_FIRSTSELITEM");[m + if (hItemFirstSel)[m + {[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m + winTreeSelectRange(ih, hItemFirstSel, hItem, 1);[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + [m + iupAttribSetStr(ih, "_IUPTREE_LASTSELITEM", (char*)hItem);[m + winTreeSetFocusNode(ih, hItem);[m +[36m@@ -1952,10 +1972,10 @@[m [mstatic int winTreeMouseMultiSelect(Ihandle* ih, int x, int y)[m + if (GetKeyState(VK_CONTROL) & 0x8000) /* Control key is down */[m + {[m + /* Toggle selection state */[m +[31m- winTreeSelectItem(ih, hItem, -1);[m +[32m+[m[32m winTreeSelectNode(ih, hItem, -1);[m + iupAttribSetStr(ih, "_IUPTREE_FIRSTSELITEM", (char*)hItem);[m + [m +[31m- winTreeCallSelectionCb(ih, winTreeIsItemSelected(ih, hItem), hItem);[m +[32m+[m[32m winTreeCallSelectionCb(ih, winTreeIsNodeSelected(ih, hItem), hItem);[m + winTreeSetFocusNode(ih, hItem);[m + [m + return 1;[m +[36m@@ -1965,9 +1985,11 @@[m [mstatic int winTreeMouseMultiSelect(Ihandle* ih, int x, int y)[m + HTREEITEM hItemFirstSel = (HTREEITEM)iupAttribGet(ih, "_IUPTREE_FIRSTSELITEM");[m + if (hItemFirstSel)[m + {[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m +[32m+[m[32m int last_id = iupTreeFindNodeId(ih, hItem);[m + winTreeSelectRange(ih, hItemFirstSel, hItem, 1);[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m +[32m+[m +[32m+[m[32m /* if last selected item is a branch, then select its children */[m +[32m+[m[32m iupTreeSelectLastCollapsedBranch(ih, &last_id);[m + [m + winTreeCallMultiSelectionCb(ih);[m + winTreeSetFocusNode(ih, hItem);[m +[36m@@ -1975,11 +1997,15 @@[m [mstatic int winTreeMouseMultiSelect(Ihandle* ih, int x, int y)[m + }[m + }[m + [m +[32m+[m[32m winTreeCallMultiUnSelectionCb(ih);[m +[32m+[m + /* simple click */[m + winTreeClearSelection(ih, hItem);[m + iupAttribSetStr(ih, "_IUPTREE_FIRSTSELITEM", (char*)hItem);[m + iupAttribSetStr(ih, "_IUPTREE_EXTENDSELECT", "1");[m + [m +[32m+[m[32m /* Call SELECT_CB for all unselected nodes */[m +[32m+[m + return 0;[m + }[m + [m +[36m@@ -2039,7 +2065,7 @@[m [mstatic int winTreeProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res[m + [m + if (wp == VK_RETURN)[m + {[m +[31m- HTREEITEM hItemFocus = winTreeGetFocusNode(ih);[m +[32m+[m[32m HTREEITEM hItemFocus = iupdrvTreeGetFocusNode(ih);[m + if (winTreeCallBranchLeafCb(ih, hItemFocus) != IUP_IGNORE)[m + winTreeExpandItem(ih, hItemFocus, -1);[m + [m +[36m@@ -2056,14 +2082,14 @@[m [mstatic int winTreeProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res[m + {[m + if (GetKeyState(VK_CONTROL) & 0x8000)[m + {[m +[31m- HTREEITEM hItemFocus = winTreeGetFocusNode(ih);[m +[32m+[m[32m HTREEITEM hItemFocus = iupdrvTreeGetFocusNode(ih);[m + /* Toggle selection state */[m +[31m- winTreeSelectItem(ih, hItemFocus, -1);[m +[32m+[m[32m winTreeSelectNode(ih, hItemFocus, -1);[m + }[m + }[m + else if (wp == VK_UP || wp == VK_DOWN)[m + {[m +[31m- HTREEITEM hItemFocus = winTreeGetFocusNode(ih);[m +[32m+[m[32m HTREEITEM hItemFocus = iupdrvTreeGetFocusNode(ih);[m + if (wp == VK_UP)[m + hItemFocus = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItemFocus);[m + else[m +[36m@@ -2084,9 +2110,7 @@[m [mstatic int winTreeProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res[m + HTREEITEM hItemFirstSel = (HTREEITEM)iupAttribGet(ih, "_IUPTREE_FIRSTSELITEM");[m + if (hItemFirstSel)[m + {[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1");[m + winTreeSelectRange(ih, hItemFirstSel, hItemFocus, 1);[m +[31m- iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", NULL);[m + [m + winTreeCallMultiSelectionCb(ih);[m + winTreeSetFocusNode(ih, hItemFocus);[m +[36m@@ -2138,10 +2162,20 @@[m [mstatic int winTreeProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res[m + }[m + break;[m + case WM_MOUSEMOVE:[m +[31m- if (ih->data->show_dragdrop && (HTREEITEM)iupAttribGet(ih, "_IUPTREE_DRAGITEM") != NULL)[m +[31m- winTreeDrag(ih, (int)(short)LOWORD(lp), (int)(short)HIWORD(lp));[m +[32m+[m[32m if (ih->data->show_dragdrop && (wp & MK_LBUTTON))[m +[32m+[m[32m {[m +[32m+[m[32m if (!iupAttribGet(ih, "_IUPTREE_DRAGITEM"))[m +[32m+[m[32m winTreeBeginDrag(ih, (int)(short)LOWORD(lp), (int)(short)HIWORD(lp));[m +[32m+[m[32m else[m[41m [m +[32m+[m[32m winTreeDrag(ih, (int)(short)LOWORD(lp), (int)(short)HIWORD(lp));[m +[32m+[m[32m }[m + else if (iupAttribGet(ih, "_IUPTREE_EXTENDSELECT"))[m +[31m- winTreeExtendSelect(ih, (int)(short)LOWORD(lp), (int)(short)HIWORD(lp));[m +[32m+[m[32m {[m +[32m+[m[32m if (wp & MK_LBUTTON)[m +[32m+[m[32m winTreeExtendSelect(ih, (int)(short)LOWORD(lp), (int)(short)HIWORD(lp));[m +[32m+[m[32m else[m +[32m+[m[32m iupAttribSetStr(ih, "_IUPTREE_EXTENDSELECT", NULL);[m +[32m+[m[32m }[m + [m + iupwinMouseMove(ih, msg, wp, lp);[m + break;[m +[36m@@ -2157,6 +2191,7 @@[m [mstatic int winTreeProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res[m + if (iupAttribGet(ih, "_IUPTREE_EXTENDSELECT"))[m + {[m + iupAttribSetStr(ih, "_IUPTREE_EXTENDSELECT", NULL);[m +[32m+[m + if (iupAttribGet(ih, "_IUPTREE_LASTSELITEM"))[m + {[m + winTreeCallMultiSelectionCb(ih);[m +[36m@@ -2205,14 +2240,19 @@[m [mstatic int winTreeWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)[m + else if (msg_info->code == TVN_SELCHANGED)[m + {[m + NMTREEVIEW* info = (NMTREEVIEW*)msg_info;[m +[31m- winTreeCallSelectionCb(ih, 0, info->itemOld.hItem); /* node unselected */[m +[31m- winTreeCallSelectionCb(ih, 1, info->itemNew.hItem); /* node selected */[m +[32m+[m[32m if (ih->data->mark_mode!=ITREE_MARK_MULTIPLE || /* (NOT) Multiple selection with Control or Shift key is down */[m +[32m+[m[32m !(GetKeyState(VK_CONTROL) & 0x8000 || GetKeyState(VK_SHIFT) & 0x8000))[m[41m [m +[32m+[m[32m {[m +[32m+[m[32m winTreeCallSelectionCb(ih, 0, info->itemOld.hItem); /* node unselected */[m +[32m+[m[32m winTreeCallSelectionCb(ih, 1, info->itemNew.hItem); /* node selected */[m +[32m+[m[32m }[m + }[m + else if(msg_info->code == TVN_BEGINLABELEDIT)[m + {[m + char* value;[m + HWND hEdit;[m + NMTVDISPINFO* info = (NMTVDISPINFO*)msg_info;[m +[32m+[m[32m IFni cbShowRename;[m + [m + if (iupAttribGet(ih, "_IUPTREE_EXTENDSELECT"))[m + {[m +[36m@@ -2220,6 +2260,13 @@[m [mstatic int winTreeWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)[m + return 1;[m + }[m + [m +[32m+[m[32m cbShowRename = (IFni)IupGetCallback(ih, "SHOWRENAME_CB");[m +[32m+[m[32m if (cbShowRename && cbShowRename(ih, iupTreeFindNodeId(ih, info->item.hItem))==IUP_IGNORE)[m +[32m+[m[32m {[m +[32m+[m[32m *result = TRUE; /* prevent the change */[m +[32m+[m[32m return 1;[m +[32m+[m[32m }[m +[32m+[m + hEdit = (HWND)SendMessage(ih->handle, TVM_GETEDITCONTROL, 0, 0);[m + [m + /* save the edit box. */[m +[36m@@ -2253,57 +2300,30 @@[m [mstatic int winTreeWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)[m + }[m + else if(msg_info->code == TVN_ENDLABELEDIT)[m + {[m +[32m+[m[32m IFnis cbRename;[m + NMTVDISPINFO* info = (NMTVDISPINFO*)msg_info;[m + [m + iupAttribSetStr(ih, "_IUPWIN_EDITBOX", NULL);[m + [m +[31m- if (info->item.pszText)[m +[31m- {[m +[31m- IFnis cbRename = (IFnis)IupGetCallback(ih, "RENAME_CB");[m +[31m- if (cbRename)[m +[31m- {[m +[31m- if (cbRename(ih, winTreeGetNodeId(ih, info->item.hItem), info->item.pszText) == IUP_IGNORE)[m +[31m- {[m +[31m- *result = FALSE;[m +[31m- return 1;[m +[31m- }[m +[31m- }[m +[32m+[m[32m if (!info->item.pszText) /* cancel, so abort */[m +[32m+[m[32m return 0;[m + [m +[31m- *result = TRUE;[m +[31m- return 1;[m +[31m- }[m +[31m- }[m +[31m- else if(msg_info->code == TVN_BEGINDRAG)[m +[31m- {[m +[31m- if (ih->data->show_dragdrop)[m +[32m+[m[32m cbRename = (IFnis)IupGetCallback(ih, "RENAME_CB");[m +[32m+[m[32m if (cbRename)[m + {[m +[31m- NMTREEVIEW* pNMTreeView = (NMTREEVIEW*)msg_info;[m +[31m- HTREEITEM hItemDrag = pNMTreeView->itemNew.hItem;[m +[31m- HIMAGELIST dragImageList;[m +[31m-[m +[31m- /* store the drag-and-drop item */[m +[31m- iupAttribSetStr(ih, "_IUPTREE_DRAGITEM", (char*)hItemDrag);[m +[31m-[m +[31m- /* get the image list for dragging */[m +[31m- dragImageList = (HIMAGELIST)SendMessage(ih->handle, TVM_CREATEDRAGIMAGE, 0, (LPARAM)hItemDrag);[m +[31m- if (dragImageList)[m +[32m+[m[32m if (cbRename(ih, iupTreeFindNodeId(ih, info->item.hItem), info->item.pszText) == IUP_IGNORE)[m + {[m +[31m- POINT pt = pNMTreeView->ptDrag;[m +[31m- ImageList_BeginDrag(dragImageList, 0, 0, 0);[m +[31m-[m +[31m- ClientToScreen(ih->handle, &pt);[m +[31m- ImageList_DragEnter(NULL, pt.x, pt.y);[m +[31m-[m +[31m- iupAttribSetStr(ih, "_IUPTREE_DRAGIMAGELIST", (char*)dragImageList);[m +[32m+[m[32m *result = FALSE;[m +[32m+[m[32m return 1;[m + }[m +[31m-[m +[31m- ShowCursor(FALSE);[m +[31m- SetCapture(ih->handle); /* drag only inside the tree */[m + }[m +[32m+[m +[32m+[m[32m *result = TRUE;[m +[32m+[m[32m return 1;[m + }[m + else if(msg_info->code == NM_DBLCLK)[m + {[m +[31m- HTREEITEM hItemFocus = winTreeGetFocusNode(ih);[m +[32m+[m[32m HTREEITEM hItemFocus = iupdrvTreeGetFocusNode(ih);[m + TVITEM item;[m + winTreeItemData* itemData;[m + [m +[36m@@ -2317,7 +2337,7 @@[m [mstatic int winTreeWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)[m + {[m + IFni cbExecuteLeaf = (IFni)IupGetCallback(ih, "EXECUTELEAF_CB");[m + if(cbExecuteLeaf)[m +[31m- cbExecuteLeaf(ih, winTreeGetNodeId(ih, hItemFocus));[m +[32m+[m[32m cbExecuteLeaf(ih, iupTreeFindNodeId(ih, hItemFocus));[m + }[m + }[m + else if(msg_info->code == TVN_ITEMEXPANDING)[m +[36m@@ -2351,7 +2371,7 @@[m [mstatic int winTreeWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)[m + HTREEITEM hItem = winTreeFindNodePointed(ih);[m + IFni cbRightClick = (IFni)IupGetCallback(ih, "RIGHTCLICK_CB");[m + if (cbRightClick)[m +[31m- cbRightClick(ih, winTreeGetNodeId(ih, hItem));[m +[32m+[m[32m cbRightClick(ih, iupTreeFindNodeId(ih, hItem));[m + }[m + else if (msg_info->code == NM_CUSTOMDRAW)[m + {[m +[36m@@ -2374,7 +2394,7 @@[m [mstatic int winTreeWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)[m + SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);[m + itemData = (winTreeItemData*)item.lParam;[m + [m +[31m- if (winTreeIsItemSelected(ih, hItem))[m +[32m+[m[32m if (GetFocus()==ih->handle && (customdraw->nmcd.uItemState & CDIS_SELECTED))[m + customdraw->clrText = winTreeInvertColor(itemData->color);[m + else[m + customdraw->clrText = itemData->color;[m +[36m@@ -2402,47 +2422,34 @@[m [mstatic int winTreeConvertXYToPos(Ihandle* ih, int x, int y)[m + info.pt.y = y;[m + hItem = (HTREEITEM)SendMessage(ih->handle, TVM_HITTEST, 0, (LPARAM)&info);[m + if (hItem)[m +[31m- return winTreeGetNodeId(ih, hItem);[m +[32m+[m[32m return iupTreeFindNodeId(ih, hItem);[m + return -1;[m + }[m + [m + [m + /*******************************************************************************************/[m + [m +[31m-static void winTreeUnMapMethod(Ihandle* ih)[m +[31m-{[m +[31m- Iarray* bmp_array;[m +[31m- HIMAGELIST image_list;[m +[31m-[m +[31m- HTREEITEM itemRoot = (HTREEITEM)SendMessage(ih->handle, TVM_GETNEXTITEM, TVGN_ROOT, 0);[m +[31m- winTreeDelNodeData(ih, itemRoot);[m +[31m-[m +[31m- image_list = (HIMAGELIST)SendMessage(ih->handle, TVM_GETIMAGELIST, TVSIL_NORMAL, 0);[m +[31m- if (image_list)[m +[31m- ImageList_Destroy(image_list);[m +[31m-[m +[31m- bmp_array = (Iarray*)iupAttribGet(ih, "_IUPWIN_BMPARRAY");[m +[31m- if (bmp_array)[m +[31m- iupArrayDestroy(bmp_array);[m +[31m-[m +[31m- iupdrvBaseUnMapMethod(ih);[m +[31m-}[m + [m + static int winTreeMapMethod(Ihandle* ih)[m + {[m +[31m- DWORD dwStyle = WS_CHILD | WS_BORDER | TVS_SHOWSELALWAYS;[m +[32m+[m[32m DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER | TVS_SHOWSELALWAYS;[m + [m +[31m- /* can be set only on the Tree View creation */[m +[32m+[m[32m /* styles can be set only on the Tree View creation */[m + [m +[31m- if (!ih->data->show_dragdrop)[m +[31m- dwStyle |= TVS_DISABLEDRAGDROP;[m +[32m+[m[32m /* always disable the internal drag&drop, because it affects our selection and drawing */[m +[32m+[m[32m dwStyle |= TVS_DISABLEDRAGDROP;[m + [m + if (ih->data->show_rename)[m + dwStyle |= TVS_EDITLABELS;[m + [m + if (!iupAttribGetBoolean(ih, "HIDELINES"))[m +[32m+[m[32m {[m + dwStyle |= TVS_HASLINES;[m + [m +[32m+[m[32m if (!iupAttribGetInt(ih, "ADDROOT"))[m +[32m+[m[32m dwStyle |= TVS_LINESATROOT;[m +[32m+[m[32m }[m +[32m+[m + if (!iupAttribGetBoolean(ih, "HIDEBUTTONS"))[m + dwStyle |= TVS_HASBUTTONS;[m + [m +[36m@@ -2455,6 +2462,11 @@[m [mstatic int winTreeMapMethod(Ihandle* ih)[m + if (!iupwinCreateWindowEx(ih, WC_TREEVIEW, 0, dwStyle))[m + return IUP_ERROR;[m + [m +[32m+[m[32m if (!iupwin_comctl32ver6) /* To improve drawing of items when TITLEFONT is set */[m +[32m+[m[32m SendMessage(ih->handle, CCM_SETVERSION, 5, 0);[m[41m [m +[32m+[m[32m else[m +[32m+[m[32m SendMessage(ih->handle, TVM_SETEXTENDEDSTYLE, TVS_EX_DOUBLEBUFFER, TVS_EX_DOUBLEBUFFER);[m[41m [m +[32m+[m + IupSetCallback(ih, "_IUPWIN_CTRLPROC_CB", (Icallback)winTreeProc);[m + IupSetCallback(ih, "_IUPWIN_NOTIFY_CB", (Icallback)winTreeWmNotify);[m + [m +[36m@@ -2466,7 +2478,7 @@[m [mstatic int winTreeMapMethod(Ihandle* ih)[m + winTreeSetBgColorAttrib(ih, value);[m + iupAttribSetStr(ih, "BGCOLOR", NULL);[m + }[m +[31m- else if (iupwinGetSystemMajorVersion()<6) /* force background in XP because of the editbox background */[m +[32m+[m[32m else if (!iupwin_comctl32ver6 || iupwinGetSystemMajorVersion()<6) /* force background in XP because of the editbox background */[m + winTreeSetBgColorAttrib(ih, IupGetGlobal("TXTBGCOLOR"));[m + }[m + [m +[36m@@ -2475,8 +2487,8 @@[m [mstatic int winTreeMapMethod(Ihandle* ih)[m + ih->data->def_image_collapsed = (void*)winTreeGetImageIndex(ih, "IMGCOLLAPSED");[m + ih->data->def_image_expanded = (void*)winTreeGetImageIndex(ih, "IMGEXPANDED");[m + [m +[31m- /* Add the Root Node */[m +[31m- winTreeAddRootNode(ih);[m +[32m+[m[32m if (iupAttribGetInt(ih, "ADDROOT"))[m +[32m+[m[32m iupdrvTreeAddNode(ih, "-1", ITREE_BRANCH, "", 0);[m + [m + /* configure for DRAG&DROP of files */[m + if (IupGetCallback(ih, "DROPFILES_CB"))[m +[36m@@ -2484,9 +2496,31 @@[m [mstatic int winTreeMapMethod(Ihandle* ih)[m + [m + IupSetCallback(ih, "_IUP_XY2POS_CB", (Icallback)winTreeConvertXYToPos);[m + [m +[32m+[m[32m iupdrvTreeUpdateMarkMode(ih);[m +[32m+[m + return IUP_NOERROR;[m + }[m + [m +[32m+[m[32mstatic void winTreeUnMapMethod(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m Iarray* bmp_array;[m +[32m+[m[32m HIMAGELIST image_list;[m +[32m+[m +[32m+[m[32m winTreeRemoveAllNodeData(ih, 0);[m +[32m+[m +[32m+[m[32m ih->data->node_count = 0;[m +[32m+[m +[32m+[m[32m image_list = (HIMAGELIST)SendMessage(ih->handle, TVM_GETIMAGELIST, TVSIL_NORMAL, 0);[m +[32m+[m[32m if (image_list)[m +[32m+[m[32m ImageList_Destroy(image_list);[m +[32m+[m +[32m+[m[32m bmp_array = (Iarray*)iupAttribGet(ih, "_IUPWIN_BMPARRAY");[m +[32m+[m[32m if (bmp_array)[m +[32m+[m[32m iupArrayDestroy(bmp_array);[m +[32m+[m +[32m+[m[32m iupdrvBaseUnMapMethod(ih);[m +[32m+[m[32m}[m +[32m+[m + void iupdrvTreeInitClass(Iclass* ic)[m + {[m + /* Driver Dependent Class functions */[m +[36m@@ -2500,7 +2534,6 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + /* IupTree Attributes - GENERAL */[m + iupClassRegisterAttribute(ic, "EXPANDALL", NULL, winTreeSetExpandAllAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "INDENTATION", winTreeGetIndentationAttrib, winTreeSetIndentationAttrib, NULL, NULL, IUPAF_DEFAULT);[m +[31m- iupClassRegisterAttribute(ic, "COUNT", winTreeGetCountAttrib, NULL, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_READONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "DRAGDROP", NULL, iupwinSetDragDropAttrib, NULL, NULL, IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "SPACING", iupTreeGetSpacingAttrib, winTreeSetSpacingAttrib, NULL, NULL, IUPAF_NOT_MAPPED);[m + iupClassRegisterAttribute(ic, "TOPITEM", NULL, winTreeSetTopItemAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m +[36m@@ -2521,7 +2554,6 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + iupClassRegisterAttributeId(ic, "NAME", winTreeGetTitleAttrib, winTreeSetTitleAttrib, IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TITLE", winTreeGetTitleAttrib, winTreeSetTitleAttrib, IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "CHILDCOUNT", winTreeGetChildCountAttrib, NULL, IUPAF_READONLY|IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttributeId(ic, "USERDATA", winTreeGetUserDataAttrib, winTreeSetUserDataAttrib, IUPAF_NO_STRING|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "COLOR", winTreeGetColorAttrib, winTreeSetColorAttrib, IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "TITLEFONT", winTreeGetTitleFontAttrib, winTreeSetTitleFontAttrib, IUPAF_NO_INHERIT);[m + [m +[36m@@ -2530,6 +2562,7 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + iupClassRegisterAttribute (ic, "MARK", NULL, winTreeSetMarkAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute (ic, "STARTING", NULL, winTreeSetMarkStartAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute (ic, "MARKSTART", NULL, winTreeSetMarkStartAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute (ic, "MARKEDNODES", winTreeGetMarkedNodesAttrib, winTreeSetMarkedNodesAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + [m + iupClassRegisterAttribute (ic, "VALUE", winTreeGetValueAttrib, winTreeSetValueAttrib, NULL, NULL, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);[m + [m +[36m@@ -2538,5 +2571,8 @@[m [mvoid iupdrvTreeInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "RENAME", NULL, winTreeSetRenameAttrib, NULL, NULL, IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "MOVENODE", NULL, winTreeSetMoveNodeAttrib, IUPAF_NOT_MAPPED|IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m + iupClassRegisterAttributeId(ic, "COPYNODE", NULL, winTreeSetCopyNodeAttrib, IUPAF_NOT_MAPPED|IUPAF_WRITEONLY|IUPAF_NO_INHERIT);[m +[31m- iupClassRegisterAttributeId(ic, "FINDUSERDATA", winTreeGetFindUserDataAttrib, NULL, IUPAF_READONLY|IUPAF_NO_INHERIT);[m +[32m+[m +[32m+[m[32m /* necessary because transparent background does not work when not using visual styles */[m +[32m+[m[32m if (!iupwin_comctl32ver6) /* Used by iupdrvImageCreateImage */[m +[32m+[m[32m iupClassRegisterAttribute(ic, "FLAT_ALPHA", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + }[m +[1mdiff --git a/iup/src/win/iupwin_val.c b/iup/src/win/iupwin_val.c[m +[1mindex 706c612..5c956d9 100755[m +[1m--- a/iup/src/win/iupwin_val.c[m +[1m+++ b/iup/src/win/iupwin_val.c[m +[36m@@ -56,6 +56,13 @@[m [mvoid iupdrvValGetMinSize(Ihandle* ih, int *w, int *h)[m + }[m + }[m + [m +[32m+[m[32mstatic int winValSetBgColorAttrib(Ihandle *ih, const char *value)[m +[32m+[m[32m{[m +[32m+[m[32m (void)value;[m +[32m+[m[32m iupdrvPostRedraw(ih);[m +[32m+[m[32m return 1;[m +[32m+[m[32m}[m +[32m+[m + static int winValSetStepAttrib(Ihandle* ih, const char* value)[m + {[m + int linesize;[m +[36m@@ -110,18 +117,6 @@[m [mstatic int winValSetValueAttrib(Ihandle* ih, const char* value)[m + /*********************************************************************************************/[m + [m + [m +[31m-static int winValCtlColor(Ihandle* ih, HDC hdc, LRESULT *result)[m +[31m-{[m +[31m- COLORREF cr;[m +[31m- if (iupwinGetParentBgColor(ih, &cr))[m +[31m- {[m +[31m- SetDCBrushColor(hdc, cr);[m +[31m- *result = (LRESULT)GetStockObject(DC_BRUSH);[m +[31m- return 1;[m +[31m- }[m +[31m- return 0;[m +[31m-}[m +[31m-[m + static int winValCustomScroll(Ihandle* ih, int msg)[m + {[m + double old_val = ih->data->val;[m +[36m@@ -190,6 +185,19 @@[m [mstatic void winValIncPageValue(Ihandle *ih, int dir)[m + winValCustomScroll(ih, 0);[m + }[m + [m +[32m+[m[32mstatic int winValCtlColor(Ihandle* ih, HDC hdc, LRESULT *result)[m +[32m+[m[32m{[m +[32m+[m[32m COLORREF cr;[m +[32m+[m[32m if (iupwinGetParentBgColor(ih, &cr))[m +[32m+[m[32m {[m +[32m+[m[32m SetBkColor(hdc, cr);[m +[32m+[m[32m SetDCBrushColor(hdc, cr);[m +[32m+[m[32m *result = (LRESULT)GetStockObject(DC_BRUSH);[m +[32m+[m[32m return 1;[m +[32m+[m[32m }[m +[32m+[m[32m return 0;[m +[32m+[m[32m}[m +[32m+[m + static int winValProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result)[m + {[m + (void)lp;[m +[36m@@ -240,7 +248,7 @@[m [mstatic int winValProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *resu[m + [m + static int winValMapMethod(Ihandle* ih)[m + {[m +[31m- DWORD dwStyle = WS_CHILD | TBS_AUTOTICKS;[m +[32m+[m[32m DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS | TBS_AUTOTICKS;[m + int show_ticks;[m + [m + if (!ih->parent)[m +[36m@@ -312,4 +320,7 @@[m [mvoid iupdrvValInitClass(Iclass* ic)[m + iupClassRegisterAttribute(ic, "STEP", iupValGetStepAttrib, winValSetStepAttrib, "0.01", NULL, IUPAF_NO_INHERIT); /* force new default value */[m + [m + iupClassRegisterAttribute(ic, "TICKSPOS", NULL, NULL, "NORMAL", NULL, IUPAF_NOT_MAPPED);[m +[32m+[m +[32m+[m[32m /* Visual */[m +[32m+[m[32m iupClassRegisterAttribute(ic, "BGCOLOR", NULL, winValSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT);[m + }[m +[1mdiff --git a/iup/srccd/Makefile b/iup/srccd/Makefile[m +[1mindex 43a3f09..8b1d154 100755[m +[1m--- a/iup/srccd/Makefile[m +[1m+++ b/iup/srccd/Makefile[m +[36m@@ -3,4 +3,4 @@[m + do_all: iupcd[m + [m + iupcd:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak [m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m[41m [m +[1mdiff --git a/iup/srccd/iup_cd.c b/iup/srccd/iup_cd.c[m +[1mindex 5998775..619ded7 100755[m +[1m--- a/iup/srccd/iup_cd.c[m +[1m+++ b/iup/srccd/iup_cd.c[m +[36m@@ -14,7 +14,6 @@[m + #include <cdiup.h>[m + #include <cdnative.h>[m + [m +[31m-[m + static void (*cdcreatecanvasNATIVE)(cdCanvas* canvas, void* data) = NULL;[m + [m + static void cdcreatecanvasIUP(cdCanvas* canvas, Ihandle *ih_canvas)[m +[36m@@ -24,8 +23,12 @@[m [mstatic void cdcreatecanvasIUP(cdCanvas* canvas, Ihandle *ih_canvas)[m + #endif[m + char* data;[m + [m +[31m- if (IupGetInt(ih_canvas, "CD_GDK"))[m +[32m+[m[32m if (cdBaseDriver()==CD_BASE_GDK)[m +[32m+[m[32m {[m + data = IupGetAttribute(ih_canvas, "DRAWABLE"); /* new IUP 3 attribute, works for GTK only */[m +[32m+[m[32m if (!data)[m +[32m+[m[32m return;[m +[32m+[m[32m }[m + else[m + {[m + #ifdef WIN32[m +[1mdiff --git a/iup/srcconsole/Makefile b/iup/srcconsole/Makefile[m +[1mindex 876ca8d..505b103 100755[m +[1m--- a/iup/srcconsole/Makefile[m +[1m+++ b/iup/srcconsole/Makefile[m +[36m@@ -3,10 +3,10 @@[m + do_all: iuplua5[m + [m + iuplua5:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak [m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m[41m [m + [m + iuplua5gtk:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak USE_GTK=Yes[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak USE_GTK=Yes[m + [m + iuplua3:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iuplua3[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iuplua3[m +[1mdiff --git a/iup/srcconsole/config.mak b/iup/srcconsole/config.mak[m +[1mindex 612a3ab..568bed6 100755[m +[1m--- a/iup/srcconsole/config.mak[m +[1m+++ b/iup/srcconsole/config.mak[m +[36m@@ -1,12 +1,23 @@[m + PROJNAME = iup[m + APPNAME = iuplua51[m +[31m-APPTYPE = console[m +[32m+[m[32mAPPTYPE = CONSOLE[m +[32m+[m +[32m+[m[32mifdef GTK_DEFAULT[m +[32m+[m[32m ifdef USE_MOTIF[m +[32m+[m[32m # Build Motif version in Linux,Darwin,FreeBSD[m +[32m+[m[32m APPNAME = iuplua51mot[m +[32m+[m[32m endif[m +[32m+[m[32melse[m[41m [m +[32m+[m[32m ifdef USE_GTK[m +[32m+[m[32m # Build GTK version in IRIX,SunOS,AIX,Win32[m +[32m+[m[32m APPNAME = iuplua51gtk[m +[32m+[m[32m endif[m +[32m+[m[32mendif[m + [m + LOHDIR = loh[m + SRCLUA = console5.lua[m + SRC = iup_lua51.c[m + [m +[31m-[m + # Disable strip[m + STRIP = [m + # Optimize[m +[36m@@ -35,6 +46,16 @@[m [mifdef DBG[m + USE_STATIC = Yes[m + USE_LUA51 = Yes[m + [m +[32m+[m[32m ifdef DBG_DIR[m +[32m+[m[32m IUPLIB = $(IUP)/lib/$(TEC_UNAME)d[m +[32m+[m[32m CDLIB = $(CD)/lib/$(TEC_UNAME)d[m +[32m+[m[32m IMLIB = $(IM)/lib/$(TEC_UNAME)d[m +[32m+[m[32m else[m +[32m+[m[32m IUPLIB = $(IUP)/lib/$(TEC_UNAME)[m +[32m+[m[32m CDLIB = $(CD)/lib/$(TEC_UNAME)[m +[32m+[m[32m IMLIB = $(IM)/lib/$(TEC_UNAME)[m +[32m+[m[32m endif[m[41m [m +[32m+[m[41m [m + DEFINES = USE_STATIC[m + [m + USE_CDLUA = Yes[m +[36m@@ -42,7 +63,6 @@[m [mifdef DBG[m + ifneq ($(findstring Win, $(TEC_SYSNAME)), )[m + LIBS += iuplua_pplot$(LIBLUASUFX) iup_pplot[m + else[m +[31m- IUPLIB = $(IUP)/lib/$(TEC_UNAME)[m + SLIB += $(IUPLIB)/libiuplua_pplot$(LIBLUASUFX).a $(IUPLIB)/libiup_pplot.a[m + endif[m + [m +[36m@@ -50,7 +70,6 @@[m [mifdef DBG[m + ifneq ($(findstring Win, $(TEC_SYSNAME)), )[m + LIBS += cdluaim$(LIBLUASUFX)[m + else[m +[31m- CDLIB = $(CD)/lib/$(TEC_UNAME)[m + SLIB += $(CDLIB)/libcdluaim$(LIBLUASUFX).a[m + endif[m + endif[m +[36m@@ -65,8 +84,6 @@[m [mifdef DBG[m + ifneq ($(findstring Win, $(TEC_SYSNAME)), )[m + LIBS += imlua_process$(LIBLUASUFX) iupluaim$(LIBLUASUFX) im_process iupim[m + else[m +[31m- IUPLIB = $(IUP)/lib/$(TEC_UNAME)[m +[31m- IMLIB = $(IM)/lib/$(TEC_UNAME)[m + SLIB += $(IMLIB)/libimlua_process$(LIBLUASUFX).a $(IUPLIB)/libiupluaim$(LIBLUASUFX).a $(IMLIB)/libim_process.a $(IUPLIB)/libiupim.a[m + endif[m + [m +[36m@@ -77,20 +94,24 @@[m [mifdef DBG[m + ifneq ($(findstring Win, $(TEC_SYSNAME)), )[m + LIBS += iupluaimglib$(LIBLUASUFX) iupimglib[m + else[m +[31m- IUPLIB = $(IUP)/lib/$(TEC_UNAME)[m + SLIB += $(IUPLIB)/libiupluaimglib$(LIBLUASUFX).a $(IUPLIB)/libiupimglib.a[m + endif[m + endif[m + else[m + ifneq ($(findstring Win, $(TEC_SYSNAME)), )[m + # Dinamically link in Windows, when not debugging[m +[31m- # Must call "tecmake dll8"[m +[32m+[m[32m # Must call "tecmake dll8" so USE_* will use the correct TEC_UNAME[m + USE_LUA51 = Yes[m + USE_DLL = Yes[m + GEN_MANIFEST = No[m + else[m + # In UNIX Lua is always statically linked, late binding is used.[m +[31m- USE_STATIC = Yes[m +[32m+[m[32m # Except in Cygwin and MacOSX[m +[32m+[m[32m ifeq ($(findstring cygw, $(TEC_UNAME)), )[m +[32m+[m[32m ifeq ($(findstring Darwin, $(TEC_UNAME)), )[m +[32m+[m[32m USE_STATIC = Yes[m +[32m+[m[32m endif[m +[32m+[m[32m endif[m + USE_LUA51 = Yes[m + endif[m + endif[m +[36m@@ -102,10 +123,13 @@[m [mifneq ($(findstring Win, $(TEC_SYSNAME)), )[m + endif[m + [m + ifneq ($(findstring cygw, $(TEC_UNAME)), )[m +[31m- LDFLAGS = -s[m + LIBS += readline history[m + endif[m + [m +[32m+[m[32mifneq ($(findstring Darwin, $(TEC_UNAME)), )[m +[32m+[m[32m LIBS += readline[m +[32m+[m[32mendif[m +[32m+[m + ifneq ($(findstring Linux, $(TEC_UNAME)), )[m + LIBS += dl [m + #To allow late binding[m +[36m@@ -129,10 +153,3 @@[m [mifneq ($(findstring AIX, $(TEC_UNAME)), )[m + LFLAGS = -Xlinker "-bbigtoc"[m + endif[m + [m +[31m-ifeq ($(TEC_UNAME), vc8)[m +[31m- ifdef DBG[m +[31m- #debug info not working for vc8 linker[m +[31m- define DBG[m +[31m- endef[m +[31m- endif[m +[31m-endif [m +[1mdiff --git a/iup/srcconsole/console5.lua b/iup/srcconsole/console5.lua[m +[1mindex 20f74b2..0b93641 100755[m +[1m--- a/iup/srcconsole/console5.lua[m +[1m+++ b/iup/srcconsole/console5.lua[m +[36m@@ -1,67 +1,69 @@[m + require"iuplua"[m + [m +[31m-iup.console = {}[m +[31m-[m + -- Utilities[m +[32m+[m[32miup_console = {}[m + [m +[31m-function iup.console.printtable(t)[m +[31m- local n,v = next(t, nil)[m +[31m- print("--printtable Start--")[m +[31m- while n do[m +[31m- print(tostring(n).."="..tostring(v))[m +[31m- n,v = next(t, n)[m +[31m- end[m +[31m- print("--printtable End--")[m +[32m+[m[32mfunction iup_console.concat(str, info)[m +[32m+[m[32m return str .. info .. "\n"[m + end[m + [m +[31m-function iup.console.print_version_info()[m +[31m- if (im) then print("IM " .. im._VERSION .. " " .. im._COPYRIGHT) end[m +[32m+[m[32mfunction iup_console.print_version_info()[m +[32m+[m[32m iup_console.clear()[m +[32m+[m[32m local str = ""[m +[32m+[m[32m if (im) then str = iup_console.concat(str, "IM " .. im._VERSION .. " " .. im._COPYRIGHT) end[m + [m +[31m- if (cd) then print("CD " .. cd._VERSION .. " " .. cd._COPYRIGHT) end[m +[32m+[m[32m if (cd) then str = iup_console.concat(str, "CD " .. cd._VERSION .. " " .. cd._COPYRIGHT) end[m + [m +[31m- print("IUP " .. iup._VERSION .. " " .. iup._COPYRIGHT)[m +[31m- print("")[m +[31m- print("IUP Info")[m +[31m- print(" System: " .. iup.GetGlobal("SYSTEM"))[m +[31m- print(" System Version: " .. iup.GetGlobal("SYSTEMVERSION"))[m +[32m+[m[32m str = iup_console.concat(str, "IUP " .. iup._VERSION .. " " .. iup._COPYRIGHT)[m +[32m+[m[32m str = iup_console.concat(str, "")[m +[32m+[m[32m str = iup_console.concat(str, "IUP Info")[m +[32m+[m[32m str = iup_console.concat(str, " System: " .. iup.GetGlobal("SYSTEM"))[m +[32m+[m[32m str = iup_console.concat(str, " System Version: " .. iup.GetGlobal("SYSTEMVERSION"))[m + [m + local mot = iup.GetGlobal("MOTIFVERSION")[m +[31m- if (mot) then print(" Motif Version: ", mot) end[m +[32m+[m[32m if (mot) then str = iup_console.concat(str, " Motif Version: ", mot) end[m + [m +[31m- print(" Screen Size: " .. iup.GetGlobal("SCREENSIZE"))[m +[31m- print(" Screen Depth: " .. iup.GetGlobal("SCREENDEPTH"))[m +[32m+[m[32m str = iup_console.concat(str, " Screen Size: " .. iup.GetGlobal("SCREENSIZE"))[m +[32m+[m[32m str = iup_console.concat(str, " Screen Depth: " .. iup.GetGlobal("SCREENDEPTH"))[m + [m +[31m- if (iup.GL_VENDOR) then print(" OpenGL Vendor: " .. iup.GL_VENDOR) end[m +[31m- if (iup.GL_RENDERER) then print(" OpenGL Renderer: " .. iup.GL_RENDERER) end[m +[31m- if (iup.GL_VERSION) then print(" OpenGL Version: " .. iup.GL_VERSION) end[m +[32m+[m[32m if (iup.GL_VENDOR) then str = iup_console.concat(str, " OpenGL Vendor: " .. iup.GL_VENDOR) end[m +[32m+[m[32m if (iup.GL_RENDERER) then str = iup_console.concat(str, " OpenGL Renderer: " .. iup.GL_RENDERER) end[m +[32m+[m[32m if (iup.GL_VERSION) then str = iup_console.concat(str, " OpenGL Version: " .. iup.GL_VERSION) end[m +[32m+[m[41m [m +[32m+[m[32m iup_console.mlCode.value=str[m + end[m + [m + -- Console Dialog[m + [m +[31m-iup.console.lastfilename = nil -- Last file open[m +[31m-iup.console.mlCode = iup.multiline{expand="YES", size="200x120", font="COURIER_NORMAL_10"}[m +[31m-iup.console.lblPosition = iup.label{title="0:0", size="50x"}[m +[31m-iup.console.lblFileName = iup.label{title="", size="50x", expand="HORIZONTAL"}[m +[32m+[m[32miup_console.lastfilename = nil -- Last file open[m +[32m+[m[32miup_console.mlCode = iup.multiline{expand="YES", size="200x120", font="COURIER_NORMAL_10"}[m +[32m+[m[32miup_console.lblPosition = iup.label{title="0:0", size="50x"}[m +[32m+[m[32miup_console.lblFileName = iup.label{title="", size="50x", expand="HORIZONTAL"}[m +[32m+[m +[32m+[m[32mfunction iup_console.mlCode:caret_cb(lin, col)[m +[32m+[m[32m iup_console.lblPosition.title = lin..":"..col[m +[32m+[m[32mend[m + [m +[31m-function iup.console.mlCode:caret_cb(lin, col)[m +[31m- iup.console.lblPosition.title = lin..":"..col[m +[32m+[m[32mfunction iup_console.clear()[m +[32m+[m[32m iup_console.mlCode.value=''[m[41m [m +[32m+[m[32m iup_console.lblFileName.title = ''[m[41m [m +[32m+[m[32m iup_console.lastfilename = nil[m + end[m + [m +[31m-iup.console.butExecute = iup.button{size="50x15", title="Execute",[m +[31m- action="iup.dostring(iup.console.mlCode.value)"}[m +[31m-iup.console.butClearCommands = iup.button{size="50x15", title="Clear",[m +[31m- action="iup.console.mlCode.value='' iup.console.lblFileName.title = '' iup.console.lastfilename = nil"}[m +[31m-iup.console.butLoadFile = iup.button{size="50x15", title="Load..."}[m +[31m-iup.console.butSaveasFile = iup.button{size="50x15", title="Save As..."}[m +[31m-iup.console.butSaveFile = iup.button{size="50x15", title="Save"}[m +[31m-[m +[31m-function iup.console.butSaveFile:action()[m +[31m- if (iup.console.lastfilename == nil) then[m +[31m- iup.console.butSaveasFile:action()[m +[32m+[m[32miup_console.butExecute = iup.button{size="50x15", title="Execute",[m +[32m+[m[32m action="iup.dostring(iup_console.mlCode.value)"}[m +[32m+[m[32miup_console.butClearCommands = iup.button{size="50x15", title="Clear", action=iup_console.clear}[m +[32m+[m[32miup_console.butLoadFile = iup.button{size="50x15", title="Load..."}[m +[32m+[m[32miup_console.butSaveasFile = iup.button{size="50x15", title="Save As..."}[m +[32m+[m[32miup_console.butSaveFile = iup.button{size="50x15", title="Save"}[m +[32m+[m +[32m+[m[32mfunction iup_console.butSaveFile:action()[m +[32m+[m[32m if (iup_console.lastfilename == nil) then[m +[32m+[m[32m iup_console.butSaveasFile:action()[m + else[m +[31m- newfile = io.open(iup.console.lastfilename, "w+")[m +[32m+[m[32m newfile = io.open(iup_console.lastfilename, "w+")[m + if (newfile) then[m +[31m- newfile:write(iup.console.mlCode.value)[m +[32m+[m[32m newfile:write(iup_console.mlCode.value)[m + newfile:close()[m + else[m + error ("Cannot Save file "..filename)[m +[36m@@ -69,21 +71,26 @@[m [mfunction iup.console.butSaveFile:action()[m + end[m + end[m + [m +[31m-function iup.console.butSaveasFile:action()[m +[31m- local fd = iup.filedlg{dialogtype="SAVE", title="Save File",[m +[32m+[m[32mfunction iup_console.butSaveasFile:action()[m +[32m+[m[32m local fd = iup.filedlg{dialogtype="SAVE", title="Save File",[m[41m [m +[32m+[m[32m nochangedir="NO", directory=iup_console.last_directory,[m + filter="*.*", filterinfo="All files",allownew=yes}[m +[32m+[m[41m [m + fd:popup(iup.LEFT, iup.LEFT)[m +[32m+[m[41m [m + local status = fd.status[m +[31m- iup.console.lastfilename = fd.value[m +[31m- iup.console.lblFileName.title = iup.console.lastfilename[m +[32m+[m[32m iup_console.lastfilename = fd.value[m +[32m+[m[32m iup_console.lblFileName.title = fd.value[m +[32m+[m[32m iup_console.last_directory = fd.directory[m + fd:destroy()[m +[32m+[m[41m [m + if status ~= "-1" then[m +[31m- if (iup.console.lastfilename == nil) then[m +[32m+[m[32m if (iup_console.lastfilename == nil) then[m + error ("Cannot Save file "..filename)[m + end[m +[31m- local newfile=io.open(iup.console.lastfilename, "w+")[m +[32m+[m[32m local newfile=io.open(iup_console.lastfilename, "w+")[m + if (newfile) then[m +[31m- newfile:write(iup.console.mlCode.value)[m +[32m+[m[32m newfile:write(iup_console.mlCode.value)[m + newfile:close(newfile)[m + else[m + error ("Cannot Save file")[m +[36m@@ -91,24 +98,26 @@[m [mfunction iup.console.butSaveasFile:action()[m + end[m + end[m + [m +[31m-function iup.console.LoadFile(filename)[m +[32m+[m[32mfunction iup_console.LoadFile(filename)[m + local newfile = io.open (filename, "r")[m + if (newfile == nil) then[m + error ("Cannot load file "..filename)[m + else[m +[31m- iup.console.mlCode.value=newfile:read("*a")[m +[32m+[m[32m iup_console.mlCode.value=newfile:read("*a")[m + newfile:close (newfile)[m +[31m- iup.console.lastfilename = filename[m +[31m- iup.console.lblFileName.title = iup.console.lastfilename[m +[32m+[m[32m iup_console.lastfilename = filename[m +[32m+[m[32m iup_console.lblFileName.title = iup_console.lastfilename[m + end[m + end[m + [m +[31m-function iup.console.butLoadFile:action()[m +[31m- local fd=iup.filedlg{dialogtype="OPEN", title="Load File",[m +[32m+[m[32mfunction iup_console.butLoadFile:action()[m +[32m+[m[32m local fd=iup.filedlg{dialogtype="OPEN", title="Load File",[m[41m [m +[32m+[m[32m nochangedir="NO", directory=iup_console.last_directory,[m + filter="*.*", filterinfo="All Files", allownew="NO"}[m + fd:popup(iup.CENTER, iup.CENTER)[m + local status = fd.status[m + local filename = fd.value[m +[32m+[m[32m iup_console.last_directory = fd.directory[m + fd:destroy()[m + [m + if (status == "-1") or (status == "1") then[m +[36m@@ -116,21 +125,21 @@[m [mfunction iup.console.butLoadFile:action()[m + error ("Cannot load file "..filename)[m + end[m + else[m +[31m- iup.console.LoadFile(filename)[m +[32m+[m[32m iup_console.LoadFile(filename)[m + end[m + end[m + [m +[31m-iup.console.vbxConsole = iup.vbox[m +[32m+[m[32miup_console.vbxConsole = iup.vbox[m + {[m +[31m- iup.frame{iup.hbox{iup.vbox{iup.console.butLoadFile,[m +[31m- iup.console.butSaveFile,[m +[31m- iup.console.butSaveasFile,[m +[31m- iup.console.butClearCommands,[m +[31m- iup.console.butExecute;[m +[32m+[m[32m iup.frame{iup.hbox{iup.vbox{iup_console.butLoadFile,[m +[32m+[m[32m iup_console.butSaveFile,[m +[32m+[m[32m iup_console.butSaveasFile,[m +[32m+[m[32m iup_console.butClearCommands,[m +[32m+[m[32m iup_console.butExecute;[m + margin="0x0", gap="10"},[m +[31m- iup.vbox{iup.console.lblFileName,[m +[31m- iup.console.mlCode,[m +[31m- iup.console.lblPosition;[m +[32m+[m[32m iup.vbox{iup_console.lblFileName,[m +[32m+[m[32m iup_console.mlCode,[m +[32m+[m[32m iup_console.lblPosition;[m + alignment = "ARIGHT"};[m + alignment="ATOP"}; title="Commands"}[m + ;alignment="ACENTER", margin="5x5", gap="5"[m +[36m@@ -138,7 +147,7 @@[m [miup.console.vbxConsole = iup.vbox[m + [m + -- Main Menu Definition.[m + [m +[31m-iup.console.mnuMain = iup.menu[m +[32m+[m[32miup_console.mnuMain = iup.menu[m + {[m + iup.submenu[m + {[m +[36m@@ -149,29 +158,29 @@[m [miup.console.mnuMain = iup.menu[m + },[m + iup.submenu{iup.menu[m + {[m +[31m- iup.item{title="Print Version Info...", action=iup.console.print_version_info},[m +[31m- iup.item{title="About...", action="iup.console.dlgAbout:popup(iup.CENTER, iup.CENTER)"}[m +[32m+[m[32m iup.item{title="Print Version Info...", action=iup_console.print_version_info},[m +[32m+[m[32m iup.item{title="About...", action="iup_console.dlgAbout:popup(iup.CENTER, iup.CENTER)"}[m + };title="Help"}[m + }[m + [m + -- Main Dialog Definition.[m + [m +[31m-iup.console.dlgMain = iup.dialog{iup.console.vbxConsole;[m +[32m+[m[32miup_console.dlgMain = iup.dialog{iup_console.vbxConsole;[m + title="IupLua Console",[m +[31m- menu=iup.console.mnuMain,[m +[32m+[m[32m menu=iup_console.mnuMain,[m + dragdrop = "YES",[m +[31m- defaultenter=iup.console.butExecute,[m +[32m+[m[32m defaultenter=iup_console.butExecute,[m + close_cb = "return iup.CLOSE"}[m + [m +[31m-function iup.console.dlgMain:dropfiles_cb(filename, num, x, y)[m +[32m+[m[32mfunction iup_console.dlgMain:dropfiles_cb(filename, num, x, y)[m + if (num == 0) then[m +[31m- iup.console.LoadFile(filename)[m +[32m+[m[32m iup_console.LoadFile(filename)[m + end[m + end[m + [m + -- About Dialog Definition.[m + [m +[31m-iup.console.dlgAbout = iup.dialog[m +[32m+[m[32miup_console.dlgAbout = iup.dialog[m + {[m + iup.vbox[m + {[m +[36m@@ -195,10 +204,12 @@[m [miup.console.dlgAbout = iup.dialog[m + [m + -- Displays the Main Dialog[m + [m +[31m-iup.console.dlgMain:show()[m +[31m-iup.SetFocus(iup.console.mlCode)[m +[32m+[m[32miup_console.dlgMain:show()[m +[32m+[m[32miup.SetFocus(iup_console.mlCode)[m + [m +[31m-iup.MainLoop()[m +[32m+[m[32mif (not iup.MainLoopLevel or iup.MainLoopLevel()==0) then[m +[32m+[m[32m iup.MainLoop()[m +[32m+[m[32mend[m + [m +[31m-iup.console.dlgMain:destroy()[m +[31m-iup.console.dlgAbout:destroy()[m +[32m+[m[32miup_console.dlgMain:destroy()[m +[32m+[m[32miup_console.dlgAbout:destroy()[m +[1mdiff --git a/iup/srcconsole/copy_all_so b/iup/srcconsole/copy_all_so[m +[1mindex 52f1fea..ce3c248 100755[m +[1m--- a/iup/srcconsole/copy_all_so[m +[1m+++ b/iup/srcconsole/copy_all_so[m +[36m@@ -2,10 +2,10 @@[m + [m + foreach plat ( Linux24 Linux24g3 Linux24g3_64 Linux26 Linux26_64 Linux26g4 Linux26g4_64 Linux26_ia64 SunOS57 SunOS510 SunOS510x86 AIX43 IRIX65 IRIX6465 )[m + echo $plat[m +[31m- cp -f ../lib/$plat/*.so ../bin/$plat[m +[31m- cp -f ../../cd/lib/$plat/*.so ../bin/$plat[m +[31m- cp -f ../../im/lib/$plat/*.so ../bin/$plat[m +[32m+[m[32m# cp -f ../lib/$plat/*.so ../bin/$plat[m +[32m+[m[32m# cp -f ../../cd/lib/$plat/*.so ../bin/$plat[m +[32m+[m[32m# cp -f ../../im/lib/$plat/*.so ../bin/$plat[m + cp -f ../../luagl/lib/$plat/*.so ../bin/$plat[m + cp -f ../../lfs/lib/$plat/*.so ../bin/$plat[m +[31m- rm -f ../bin/$plat/*3.so[m +[32m+[m[32m# rm -f ../bin/$plat/*3.so[m + end[m +[1mdiff --git a/iup/srcconsole/copy_so b/iup/srcconsole/copy_so[m +[1mindex 2535766..e345d31 100755[m +[1m--- a/iup/srcconsole/copy_so[m +[1m+++ b/iup/srcconsole/copy_so[m +[36m@@ -1,4 +1,6 @@[m + cp -f ../lib/${TEC_UNAME}/*.so ../bin/$TEC_UNAME[m + cp -f ../../cd/lib/${TEC_UNAME}/*.so ../bin/$TEC_UNAME[m + cp -f ../../im/lib/${TEC_UNAME}/*.so ../bin/$TEC_UNAME[m +[32m+[m[32mcp -f ../../luagl/lib/${TEC_UNAME}/*.so ../bin/${TEC_UNAME}[m +[32m+[m[32mcp -f ../../lfs/lib/${TEC_UNAME}/*.so ../bin/${TEC_UNAME}[m + rm -f ../bin/${TEC_UNAME}/*3.so[m +[1mdiff --git a/iup/srcconsole/iuplua3.rc b/iup/srcconsole/iuplua3.rc[m +[1mindex e741199..9fcc280 100755[m +[1m--- a/iup/srcconsole/iuplua3.rc[m +[1m+++ b/iup/srcconsole/iuplua3.rc[m +[36m@@ -13,7 +13,7 @@[m [mBEGIN[m + VALUE "CompanyName", "Tecgraf/PUC-Rio\0"[m + VALUE "FileDescription", "Lua Windows Standalone Interpreter with IUP\0"[m + VALUE "FileVersion", "3.0.0\0"[m +[31m- VALUE "LegalCopyright", "Copyright © 1994-2009 Tecgraf, PUC-Rio.\0"[m +[32m+[m[32m VALUE "LegalCopyright", "Copyright © 1994-2010 Tecgraf, PUC-Rio.\0"[m + VALUE "OriginalFilename", "iuplua51.exe\0"[m + VALUE "ProductName", "IUP for Windows\0"[m + VALUE "ProductVersion", "3.0.0\0"[m +[1mdiff --git a/iup/srcconsole/iuplua5.rc b/iup/srcconsole/iuplua5.rc[m +[1mindex bc02e07..70e40a4 100755[m +[1m--- a/iup/srcconsole/iuplua5.rc[m +[1m+++ b/iup/srcconsole/iuplua5.rc[m +[36m@@ -13,7 +13,7 @@[m [mBEGIN[m + VALUE "CompanyName", "Tecgraf/PUC-Rio\0"[m + VALUE "FileDescription", "Lua Windows Standalone Interpreter with IUP\0"[m + VALUE "FileVersion", "3.0.0\0"[m +[31m- VALUE "LegalCopyright", "Copyright © 1994-2009 Tecgraf, PUC-Rio.\0"[m +[32m+[m[32m VALUE "LegalCopyright", "Copyright © 1994-2010 Tecgraf, PUC-Rio.\0"[m + VALUE "OriginalFilename", "iuplua51.exe\0"[m + VALUE "ProductName", "IUP for Windows\0"[m + VALUE "ProductVersion", "3.0.0\0"[m +[1mdiff --git a/iup/srcconsole/make_uname.bat b/iup/srcconsole/make_uname.bat[m +[1mindex a5b1d9a..a0db110 100755[m +[1m--- a/iup/srcconsole/make_uname.bat[m +[1m+++ b/iup/srcconsole/make_uname.bat[m +[36m@@ -6,24 +6,26 @@[m [mif "%1"=="vc8_64" goto iupexe64[m + if "%1"=="all" goto iupexe[m + goto end[m + [m +[32m+[m[32mREM Must use dll8 so USE_* will use the correct TEC_UNAME[m +[32m+[m + :iupexe32[m + call tecmake dll8 relink %2 %3 %4 %5 %6 %7[m +[31m-REM call tecmake dll8 USE_GTK=Yes relink %2 %3 %4 %5 %6 %7[m +[32m+[m[32mREM call tecmake vc8 USE_GTK=Yes relink %2 %3 %4 %5 %6 %7[m + REM call tecmake vc8 "MF=iuplua3" relink %2 %3 %4 %5 %6 %7[m + goto end[m + [m + :iupexe64[m + call tecmake dll8_64 relink %2 %3 %4 %5 %6 %7[m +[31m-REM call tecmake dll8_64 USE_GTK=Yes relink %2 %3 %4 %5 %6 %7[m +[32m+[m[32mREM call tecmake vc8_64 USE_GTK=Yes relink %2 %3 %4 %5 %6 %7[m + REM call tecmake vc8_64 "MF=iuplua3" relink %2 %3 %4 %5 %6 %7[m + goto end[m + [m + :iupexe[m + call tecmake dll8 relink %2 %3 %4 %5 %6 %7[m +[31m-REM call tecmake dll8 USE_GTK=Yes relink %2 %3 %4 %5 %6 %7[m +[32m+[m[32mREM call tecmake vc8 USE_GTK=Yes relink %2 %3 %4 %5 %6 %7[m + REM call tecmake vc8 "MF=iuplua3" relink %2 %3 %4 %5 %6 %7[m + call tecmake dll8_64 relink %2 %3 %4 %5 %6 %7[m +[31m-REM call tecmake dll8_64 USE_GTK=Yes relink %2 %3 %4 %5 %6 %7[m +[32m+[m[32mREM call tecmake vc8_64 USE_GTK=Yes relink %2 %3 %4 %5 %6 %7[m + REM call tecmake vc8_64 "MF=iuplua3" relink %2 %3 %4 %5 %6 %7[m + goto end[m + [m +[1mdiff --git a/iup/srccontrols/Makefile b/iup/srccontrols/Makefile[m +[1mindex d02bbc3..c928251 100755[m +[1m--- a/iup/srccontrols/Makefile[m +[1m+++ b/iup/srccontrols/Makefile[m +[36m@@ -3,4 +3,4 @@[m + do_all: iupcontrols[m + [m + iupcontrols:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak [m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m[41m [m +[1mdiff --git a/iup/srccontrols/color/iup_colorbrowser.c b/iup/srccontrols/color/iup_colorbrowser.c[m +[1mindex 82b4a88..51f8a30 100755[m +[1m--- a/iup/srccontrols/color/iup_colorbrowser.c[m +[1m+++ b/iup/srccontrols/color/iup_colorbrowser.c[m +[36m@@ -681,7 +681,7 @@[m [mstatic int iColorBrowserKeypress_CB(Ihandle* ih, int c, int press)[m + static char* iColorBrowserGetHSIAttrib(Ihandle* ih)[m + {[m + char* buffer = iupStrGetMemory(100);[m +[31m- sprintf(buffer, "%f %f %f", (double)ih->data->hue, (double)ih->data->saturation, (double)ih->data->intensity);[m +[32m+[m[32m sprintf(buffer, "%g %g %g", (double)ih->data->hue, (double)ih->data->saturation, (double)ih->data->intensity);[m + return buffer;[m + }[m + [m +[36m@@ -781,10 +781,16 @@[m [mstatic int iColorBrowserMapMethod(Ihandle* ih)[m + static void iColorBrowserUnMapMethod(Ihandle* ih)[m + {[m + if (ih->data->cddbuffer)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cddbuffer);[m +[32m+[m[32m ih->data->cddbuffer = NULL;[m +[32m+[m[32m }[m + [m + if (ih->data->cdcanvas)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cdcanvas);[m +[32m+[m[32m ih->data->cdcanvas = NULL;[m +[32m+[m[32m }[m + }[m + [m + static int iColorBrowserCreateMethod(Ihandle* ih, void **params)[m +[1mdiff --git a/iup/srccontrols/color/iup_colorbrowserdlg.c b/iup/srccontrols/color/iup_colorbrowserdlg.c[m +[1mindex 65e4d37..dc52725 100755[m +[1m--- a/iup/srccontrols/color/iup_colorbrowserdlg.c[m +[1m+++ b/iup/srccontrols/color/iup_colorbrowserdlg.c[m +[36m@@ -158,7 +158,7 @@[m [mstatic void iColorBrowserDlgBrowserRGB_Update(IcolorDlgData* colordlg_data)[m + [m + static void iColorBrowserDlgBrowserHSI_Update(IcolorDlgData* colordlg_data)[m + {[m +[31m- IupSetfAttribute(colordlg_data->color_browser, "HSI", "%f %f %f", (double)colordlg_data->hue, (double)colordlg_data->saturation, (double)colordlg_data->intensity);[m +[32m+[m[32m IupSetfAttribute(colordlg_data->color_browser, "HSI", "%g %g %g", (double)colordlg_data->hue, (double)colordlg_data->saturation, (double)colordlg_data->intensity);[m + }[m + [m + /*****************************************\[m +[36m@@ -575,10 +575,16 @@[m [mstatic int iColorBrowserDlgColorCnvUnMap_CB(Ihandle* ih)[m + IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");[m + [m + if (colordlg_data->color_cddbuffer)[m +[32m+[m[32m {[m + cdKillCanvas(colordlg_data->color_cddbuffer);[m +[32m+[m[32m colordlg_data->color_cddbuffer = NULL;[m +[32m+[m[32m }[m + [m + if (colordlg_data->color_cdcanvas)[m +[32m+[m[32m {[m + cdKillCanvas(colordlg_data->color_cdcanvas);[m +[32m+[m[32m colordlg_data->color_cdcanvas = NULL;[m +[32m+[m[32m }[m + [m + return IUP_DEFAULT;[m + }[m +[1mdiff --git a/iup/srccontrols/config.mak b/iup/srccontrols/config.mak[m +[1mindex 394d607..10f11e1 100755[m +[1m--- a/iup/srccontrols/config.mak[m +[1m+++ b/iup/srccontrols/config.mak[m +[36m@@ -13,7 +13,7 @@[m [mSRCMATRIX = iupmat_key.c iupmat_mark.c iupmat_aux.c iupmat_mem.c iupmat_mouse.c[m + SRCMATRIX := $(addprefix matrix/, $(SRCMATRIX))[m + [m + SRC = iup_cdutil.c iup_gauge.c iup_cells.c iup_colorbar.c iup_controls.c \[m +[31m- iup_dial.c iup_oldtabs.c iup_oldval.c iup_oldmask.c \[m +[32m+[m[32m iup_dial.c iup_oldmask.c \[m + $(SRCCOLOR) $(SRCMATRIX)[m + [m + LIBS = iup iupcd[m +[1mdiff --git a/iup/srccontrols/iup_cells.c b/iup/srccontrols/iup_cells.c[m +[1mindex d9a7fe4..c771d6e 100755[m +[1m--- a/iup/srccontrols/iup_cells.c[m +[1m+++ b/iup/srccontrols/iup_cells.c[m +[36m@@ -882,10 +882,16 @@[m [mstatic int iCellsMapMethod(Ihandle* ih)[m + static void iCellsUnMapMethod(Ihandle* ih)[m + {[m + if (ih->data->cddbuffer)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cddbuffer);[m +[32m+[m[32m ih->data->cddbuffer = NULL;[m +[32m+[m[32m }[m + [m + if (ih->data->cdcanvas)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cdcanvas);[m +[32m+[m[32m ih->data->cdcanvas = NULL;[m +[32m+[m[32m }[m + }[m + [m + static int iCellsCreateMethod(Ihandle* ih, void **params)[m +[1mdiff --git a/iup/srccontrols/iup_colorbar.c b/iup/srccontrols/iup_colorbar.c[m +[1mindex 72e717c..1cbcd59 100755[m +[1m--- a/iup/srccontrols/iup_colorbar.c[m +[1m+++ b/iup/srccontrols/iup_colorbar.c[m +[36m@@ -978,10 +978,16 @@[m [mstatic int iColorbarMapMethod(Ihandle* ih)[m + static void iColorbarUnMapMethod(Ihandle* ih)[m + {[m + if (ih->data->cddbuffer)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cddbuffer);[m +[32m+[m[32m ih->data->cddbuffer = NULL;[m +[32m+[m[32m }[m + [m + if (ih->data->cdcanvas)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cdcanvas);[m +[32m+[m[32m ih->data->cdcanvas = NULL;[m +[32m+[m[32m }[m + }[m + [m + static int iColorbarCreateMethod(Ihandle* ih, void **params)[m +[1mdiff --git a/iup/srccontrols/iup_dial.c b/iup/srccontrols/iup_dial.c[m +[1mindex 1dd2d0f..c8c5656 100755[m +[1m--- a/iup/srccontrols/iup_dial.c[m +[1m+++ b/iup/srccontrols/iup_dial.c[m +[36m@@ -640,7 +640,7 @@[m [mstatic int iDialWheel_CB(Ihandle* ih, float delta)[m + static char* iDialGetValueAttrib(Ihandle* ih)[m + {[m + char* str = iupStrGetMemory(20);[m +[31m- sprintf(str, "%f", ih->data->angle);[m +[32m+[m[32m sprintf(str, "%g", ih->data->angle);[m + return str;[m + }[m + [m +[36m@@ -665,7 +665,7 @@[m [mstatic int iDialSetDensityAttrib(Ihandle* ih, const char* value)[m + static char* iDialGetDensityAttrib(Ihandle* ih)[m + {[m + char* str = iupStrGetMemory(20);[m +[31m- sprintf(str, "%f", ih->data->density);[m +[32m+[m[32m sprintf(str, "%g", ih->data->density);[m + return str;[m + }[m + [m +[36m@@ -780,10 +780,16 @@[m [mstatic int iDialMapMethod(Ihandle* ih)[m + static void iDialUnMapMethod(Ihandle* ih)[m + {[m + if (ih->data->cddbuffer)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cddbuffer);[m +[32m+[m[32m ih->data->cddbuffer = NULL;[m +[32m+[m[32m }[m + [m + if (ih->data->cdcanvas)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cdcanvas);[m +[32m+[m[32m ih->data->cdcanvas = NULL;[m +[32m+[m[32m }[m + }[m + [m + static int iDialCreateMethod(Ihandle* ih, void **params)[m +[1mdiff --git a/iup/srccontrols/iup_gauge.c b/iup/srccontrols/iup_gauge.c[m +[1mindex 8732eee..300b28e 100755[m +[1m--- a/iup/srccontrols/iup_gauge.c[m +[1m+++ b/iup/srccontrols/iup_gauge.c[m +[36m@@ -347,10 +347,16 @@[m [mstatic char* iGaugeGetTextAttrib(Ihandle* ih)[m + static void iGaugeUnMapMethod(Ihandle* ih)[m + {[m + if (ih->data->cddbuffer)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cddbuffer);[m +[32m+[m[32m ih->data->cddbuffer = NULL;[m +[32m+[m[32m }[m + [m + if (ih->data->cdcanvas)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cdcanvas);[m +[32m+[m[32m ih->data->cdcanvas = NULL;[m +[32m+[m[32m }[m + }[m + [m + static int iGaugeMapMethod(Ihandle* ih)[m +[1mdiff --git a/iup/srccontrols/iup_oldmask.c b/iup/srccontrols/iup_oldmask.c[m +[1mindex fec10f3..2ec4012 100755[m +[1m--- a/iup/srccontrols/iup_oldmask.c[m +[1m+++ b/iup/srccontrols/iup_oldmask.c[m +[36m@@ -42,14 +42,14 @@[m [mint iupmaskMatSetInt(Ihandle *ih, int autofill, int min, int max, int lin, int c[m + int iupmaskSetFloat(Ihandle* ih, int autofill, float min, float max)[m + {[m + (void)autofill;[m +[31m- IupSetfAttribute(ih,"MASKFLOAT", "%f:%f", min, max);[m +[32m+[m[32m IupSetfAttribute(ih,"MASKFLOAT", "%g:%g", min, max);[m + return 1;[m + }[m + [m + int iupmaskMatSetFloat(Ihandle* ih, int autofill, float min, float max, int lin, int col)[m + {[m + (void)autofill;[m +[31m- IupMatSetfAttribute(ih,"MASKFLOAT", lin, col, "%f:%f", min, max);[m +[32m+[m[32m IupMatSetfAttribute(ih,"MASKFLOAT", lin, col, "%g:%g", min, max);[m + return 0;[m + }[m + [m +[1mdiff --git a/iup/srccontrols/iup_oldtabs.c b/iup/srccontrols/iup_oldtabs.c[m +[1mindex 43b0c57..5ea7f0a 100755[m +[1m--- a/iup/srccontrols/iup_oldtabs.c[m +[1m+++ b/iup/srccontrols/iup_oldtabs.c[m +[36m@@ -2487,10 +2487,16 @@[m [mstatic int iTabsMapMethod(Ihandle* ih)[m + static void iTabsUnMapMethod(Ihandle* ih)[m + {[m + if (ih->data->cddbuffer)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cddbuffer);[m +[32m+[m[32m ih->data->cddbuffer = NULL;[m +[32m+[m[32m }[m + [m + if (ih->data->cdcanvas)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cdcanvas);[m +[32m+[m[32m ih->data->cdcanvas = NULL;[m +[32m+[m[32m }[m + }[m + [m + static void iTabsDestroyMethod(Ihandle* ih)[m +[1mdiff --git a/iup/srccontrols/iup_oldval.c b/iup/srccontrols/iup_oldval.c[m +[1mindex 50dae8a..9c14c90 100755[m +[1m--- a/iup/srccontrols/iup_oldval.c[m +[1m+++ b/iup/srccontrols/iup_oldval.c[m +[36m@@ -533,7 +533,7 @@[m [mstatic char* iValGetTypeAttrib(Ihandle* ih)[m + static char* iValGetValueAttrib(Ihandle* ih)[m + {[m + char* str = iupStrGetMemory(20);[m +[31m- sprintf(str, "%f", ih->data->val);[m +[32m+[m[32m sprintf(str, "%g", ih->data->val);[m + return str;[m + }[m + [m +[36m@@ -576,7 +576,7 @@[m [mstatic int iValSetStepAttrib(Ihandle* ih, const char* step)[m + static char* iValGetStepAttrib(Ihandle* ih)[m + {[m + char* str = iupStrGetMemory(20);[m +[31m- sprintf(str, "%f", ih->data->step);[m +[32m+[m[32m sprintf(str, "%g", ih->data->step);[m + return str;[m + }[m + [m +[36m@@ -590,7 +590,7 @@[m [mstatic int iValSetPageStepAttrib(Ihandle* ih, const char* pagestep)[m + static char* iValGetPageStepAttrib(Ihandle* ih)[m + {[m + char* str = iupStrGetMemory(20);[m +[31m- sprintf(str, "%f", ih->data->pagestep);[m +[32m+[m[32m sprintf(str, "%g", ih->data->pagestep);[m + return str;[m + }[m + [m +[36m@@ -605,7 +605,7 @@[m [mstatic int iValSetMaxAttrib(Ihandle* ih, const char* max)[m + static char* iValGetMaxAttrib(Ihandle* ih)[m + {[m + char* str = iupStrGetMemory(20);[m +[31m- sprintf(str, "%f", ih->data->vmax);[m +[32m+[m[32m sprintf(str, "%g", ih->data->vmax);[m + return str;[m + }[m + [m +[36m@@ -620,7 +620,7 @@[m [mstatic int iValSetMinAttrib(Ihandle* ih, const char* min)[m + static char* iValGetMinAttrib(Ihandle* ih)[m + {[m + char* str = iupStrGetMemory(20);[m +[31m- sprintf(str, "%f", ih->data->vmin);[m +[32m+[m[32m sprintf(str, "%g", ih->data->vmin);[m + return str;[m + }[m + [m +[36m@@ -719,10 +719,16 @@[m [mstatic int iValMapMethod(Ihandle* ih)[m + static void iValUnMapMethod(Ihandle* ih)[m + {[m + if (ih->data->cddbuffer)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cddbuffer);[m +[32m+[m[32m ih->data->cddbuffer = NULL;[m +[32m+[m[32m }[m + [m + if (ih->data->cdcanvas)[m +[32m+[m[32m {[m + cdKillCanvas(ih->data->cdcanvas);[m +[32m+[m[32m ih->data->cdcanvas = NULL;[m +[32m+[m[32m }[m + }[m + [m + static void iValDestroyMethod(Ihandle* ih)[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_aux.c b/iup/srccontrols/matrix/iupmat_aux.c[m +[1mindex f8b85bb..1a8df57 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_aux.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_aux.c[m +[36m@@ -24,16 +24,11 @@[m + #include "iupmat_getset.h"[m + [m + [m +[31m-static int iMatrixAuxIsFullVisibleLast(Ihandle* ih, int m)[m +[32m+[m[32mint iupMatrixAuxIsFullVisibleLast(ImatLinColData *p)[m + {[m + int i, sum = 0;[m +[31m- ImatLinColData *p;[m +[31m-[m +[31m- if (m == IMAT_PROCESS_LIN)[m +[31m- p = &(ih->data->lines);[m +[31m- else[m +[31m- p = &(ih->data->columns);[m + [m +[32m+[m[32m sum -= p->first_offset;[m + for(i = p->first; i <= p->last; i++)[m + sum += p->sizes[i];[m + [m +[36m@@ -43,16 +38,20 @@[m [mstatic int iMatrixAuxIsFullVisibleLast(Ihandle* ih, int m)[m + return 1;[m + }[m + [m +[31m-int iupMatrixAuxIsCellFullVisible(Ihandle* ih, int lin, int col)[m +[32m+[m[32mint iupMatrixAuxIsCellStartVisible(Ihandle* ih, int lin, int col)[m + {[m + if(((lin >= ih->data->lines.first) &&[m + (lin <= ih->data->lines.last) &&[m + (col >= ih->data->columns.first) &&[m + (col <= ih->data->columns.last)))[m + {[m +[31m- if (col == ih->data->columns.last && !iMatrixAuxIsFullVisibleLast(ih, IMAT_PROCESS_COL))[m +[32m+[m[32m if (col == ih->data->columns.first && ih->data->columns.first_offset!=0)[m +[32m+[m[32m return 0;[m +[32m+[m[32m if (lin == ih->data->lines.first && ih->data->lines.first_offset!=0)[m + return 0;[m +[31m- if (lin == ih->data->lines.last && !iMatrixAuxIsFullVisibleLast(ih, IMAT_PROCESS_LIN))[m +[32m+[m[32m if (col == ih->data->columns.last && !iupMatrixAuxIsFullVisibleLast(&ih->data->columns))[m +[32m+[m[32m return 0;[m +[32m+[m[32m if (lin == ih->data->lines.last && !iupMatrixAuxIsFullVisibleLast(&ih->data->lines))[m + return 0;[m + [m + return 1;[m +[36m@@ -81,18 +80,98 @@[m [mvoid iupMatrixAuxGetVisibleCellDim(Ihandle* ih, int lin, int col, int* x, int* y[m + /* find the position where the column starts */[m + *x = ih->data->columns.sizes[0];[m + for(i = ih->data->columns.first; i < col; i++)[m +[32m+[m[32m {[m + *x += ih->data->columns.sizes[i];[m + [m +[31m- /* find the column size */[m +[32m+[m[32m if (i == ih->data->columns.first)[m +[32m+[m[32m *x -= ih->data->columns.first_offset;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m /* get the column size */[m + *w = ih->data->columns.sizes[col] - 1;[m +[32m+[m[32m if (col == ih->data->columns.first)[m +[32m+[m[32m *w -= ih->data->columns.first_offset;[m + [m + /* find the position where the line starts */[m + *y = ih->data->lines.sizes[0];[m + for(i = ih->data->lines.first; i < lin; i++)[m +[32m+[m[32m {[m + *y += ih->data->lines.sizes[i];[m + [m +[31m- /* find the line size */[m +[32m+[m[32m if (i == ih->data->lines.first)[m +[32m+[m[32m *y -= ih->data->lines.first_offset;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m /* get the line size */[m + *h = ih->data->lines.sizes[lin] - 1;[m +[32m+[m[32m if (lin == ih->data->lines.first)[m +[32m+[m[32m *h -= ih->data->lines.first_offset;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupMatrixAuxAdjustFirstFromLast(ImatLinColData* p)[m +[32m+[m[32m{[m +[32m+[m[32m int i, sum = 0;[m +[32m+[m +[32m+[m[32m /* adjust "first" according to "last" */[m +[32m+[m +[32m+[m[32m i = p->last;[m +[32m+[m[32m sum = p->sizes[i];[m +[32m+[m[32m while (i>1 && sum < p->visible_size)[m +[32m+[m[32m {[m +[32m+[m[32m i--;[m +[32m+[m[32m sum += p->sizes[i];[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m if (i==1 && sum < p->visible_size)[m +[32m+[m[32m {[m +[32m+[m[32m /* if there are room for everyone then position at start */[m +[32m+[m[32m p->first = 1;[m +[32m+[m[32m p->first_offset = 0;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m /* the "while" found an index for first */[m +[32m+[m[32m p->first = i;[m +[32m+[m +[32m+[m[32m /* position at the remaing space */[m +[32m+[m[32m p->first_offset = sum - p->visible_size;[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mvoid iupMatrixAuxAdjustFirstFromScrollPos(ImatLinColData* p, int scroll_pos)[m +[32m+[m[32m{[m +[32m+[m[32m int index, sp, offset = 0;[m +[32m+[m +[32m+[m[32m sp = 0;[m +[32m+[m[32m for(index = 1; index < p->num; index++)[m +[32m+[m[32m {[m +[32m+[m[32m sp += p->sizes[index];[m +[32m+[m[32m if (sp > scroll_pos)[m +[32m+[m[32m {[m +[32m+[m[32m sp -= p->sizes[index]; /* get the previous value */[m +[32m+[m[32m offset = scroll_pos - sp;[m +[32m+[m[32m break;[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m if (index == p->num)[m +[32m+[m[32m {[m +[32m+[m[32m if (p->num == 1)[m +[32m+[m[32m {[m +[32m+[m[32m /* did NOT go trough the "for" above */[m +[32m+[m[32m offset = scroll_pos;[m +[32m+[m[32m index = 1;[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m {[m +[32m+[m[32m /* go all the way trough the "for" above, but still sp < scroll_pos */[m +[32m+[m[32m offset = scroll_pos - sp;[m +[32m+[m[32m index = p->num-1;[m +[32m+[m[32m }[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m p->first = index;[m +[32m+[m[32m p->first_offset = offset;[m + }[m + [m + /* Calculate the size, in pixels, of the invisible columns/lines,[m +[36m@@ -101,10 +180,11 @@[m [mvoid iupMatrixAuxGetVisibleCellDim(Ihandle* ih, int lin, int col, int* x, int* y[m + Depends on the first visible column/line.[m + -> m : choose will operate on lines or columns [IMAT_PROCESS_LIN|IMAT_PROCESS_COL][m + */[m +[31m-void iupMatrixAuxUpdateVisiblePos(Ihandle* ih, int m)[m +[32m+[m[32mvoid iupMatrixAuxUpdateScrollPos(Ihandle* ih, int m)[m + {[m +[32m+[m[32m float pos;[m +[32m+[m[32m int i, sb, scroll_pos;[m + char* POS;[m +[31m- int i, sb, visible_pos;[m + ImatLinColData *p;[m + [m + if (m == IMAT_PROCESS_LIN)[m +[36m@@ -120,33 +200,44 @@[m [mvoid iupMatrixAuxUpdateVisiblePos(Ihandle* ih, int m)[m + POS = "POSX";[m + }[m + [m +[31m- visible_pos = 0;[m +[31m- for(i = 1; i < p->first; i++)[m +[31m- visible_pos += p->sizes[i];[m +[32m+[m[32m /* "first" was changed, so update "last" and the scroll pos */[m + [m +[31m- if (ih->data->canvas.sb & sb)[m +[32m+[m[32m if (p->total_size <= p->visible_size)[m + {[m +[31m- float pos;[m +[32m+[m[32m /* the matrix is fully visible */[m +[32m+[m[32m p->first = 1;[m +[32m+[m[32m p->first_offset = 0;[m +[32m+[m[32m p->last = p->num==1? 1: p->num-1;[m + [m +[31m- if (p->total_size)[m +[31m- {[m +[31m- while ((visible_pos + p->visible_size > p->total_size) && p->first>1)[m +[31m- {[m +[31m- /* invalid position, must recalculate first */[m +[31m- p->first--;[m +[31m- visible_pos -= p->sizes[p->first];[m +[31m- }[m +[32m+[m[32m if (ih->data->canvas.sb & sb)[m +[32m+[m[32m IupSetAttribute(ih, POS, "0");[m + [m +[31m- pos = (float)visible_pos/(float)p->total_size;[m +[31m- }[m +[31m- else[m +[31m- pos = 0;[m +[32m+[m[32m return;[m +[32m+[m[32m }[m +[32m+[m +[32m+[m[32m /* must check if it is a valid position */[m +[32m+[m[32m scroll_pos = 0;[m +[32m+[m[32m for(i = 1; i < p->first; i++)[m +[32m+[m[32m scroll_pos += p->sizes[i];[m +[32m+[m[32m scroll_pos += p->first_offset;[m +[32m+[m +[32m+[m[32m if (scroll_pos + p->visible_size > p->total_size)[m +[32m+[m[32m {[m +[32m+[m[32m /* invalid condition, must recalculate so it is valid */[m +[32m+[m[32m scroll_pos = p->total_size - p->visible_size;[m + [m +[31m- iupMatrixAuxUpdateLast(p);[m +[31m- IupSetfAttribute(ih, POS, "%.5f", (double)pos);[m +[32m+[m[32m /* position first and first_offset, according to scroll pos */[m +[32m+[m[32m iupMatrixAuxAdjustFirstFromScrollPos(p, scroll_pos);[m + }[m +[31m- else[m +[31m- iupMatrixAuxUpdateLast(p);[m +[32m+[m +[32m+[m[32m pos = (float)scroll_pos/(float)p->total_size;[m +[32m+[m +[32m+[m[32m /* update last */[m +[32m+[m[32m iupMatrixAuxUpdateLast(p);[m +[32m+[m +[32m+[m[32m /* update scroll pos */[m +[32m+[m[32m if (ih->data->canvas.sb & sb)[m +[32m+[m[32m IupSetfAttribute(ih, POS, "%g", (double)pos);[m + }[m + [m + /* Calculate which is the last visible column/line of the matrix. [m +[36m@@ -157,18 +248,24 @@[m [mvoid iupMatrixAuxUpdateLast(ImatLinColData *p)[m + [m + if (p->visible_size > 0)[m + {[m +[31m- /* Find which is the last column/line[m +[32m+[m[32m /* Find which is the last column/line.[m + Start in the first visible and continue adding the widths[m +[31m- up to the visible size */[m +[32m+[m[32m up to the visible size */[m +[32m+[m[32m sum -= p->first_offset;[m + for(i = p->first; i < p->num; i++)[m + {[m +[31m- sum += p->sizes[i];[m +[32m+[m[32m sum += p->sizes[i];[m + if(sum >= p->visible_size)[m + break;[m + }[m + [m + if (i == p->num)[m +[31m- p->last = i-1;[m +[32m+[m[32m {[m +[32m+[m[32m if (p->num == 1)[m +[32m+[m[32m p->last = 1;[m +[32m+[m[32m else[m +[32m+[m[32m p->last = p->num-1;[m +[32m+[m[32m }[m + else[m + p->last = i;[m + }[m +[36m@@ -185,7 +282,7 @@[m [mint iupMatrixAuxGetColumnWidth(Ihandle* ih, int col)[m + char* str = iupStrGetMemory(100);[m + char* value;[m + [m +[31m- /* can only be called for valid columns */[m +[32m+[m[32m /* can be called for invalid columns (col>numcol) */[m + [m + sprintf(str, "WIDTH%d", col);[m + value = iupAttribGet(ih, str);[m +[36m@@ -219,7 +316,7 @@[m [mint iupMatrixAuxGetColumnWidth(Ihandle* ih, int col)[m + width = max_width;[m + }[m + }[m +[31m- else if (ih->data->use_title_size)[m +[32m+[m[32m else if (ih->data->use_title_size && (col>=0 && col<ih->data->columns.num))[m + {[m + char* title_value = iupMatrixCellGetValue(ih, 0, col);[m + if (title_value)[m +[36m@@ -257,7 +354,7 @@[m [mint iupMatrixAuxGetLineHeight(Ihandle* ih, int lin)[m + char* str = iupStrGetMemory(100);[m + char* value;[m + [m +[31m- /* can only be called for valid lines */[m +[32m+[m[32m /* can be called for invalid lines (lin>numlin) */[m + [m + sprintf(str, "HEIGHT%d", lin);[m + value = iupAttribGet(ih, str);[m +[36m@@ -291,7 +388,7 @@[m [mint iupMatrixAuxGetLineHeight(Ihandle* ih, int lin)[m + height = max_height;[m + }[m + }[m +[31m- else if (ih->data->use_title_size)[m +[32m+[m[32m else if (ih->data->use_title_size && (lin>=0 && lin<ih->data->lines.num))[m + {[m + char* title_value = iupMatrixCellGetValue(ih, lin, 0);[m + if (title_value && title_value[0])[m +[36m@@ -374,7 +471,7 @@[m [mstatic void iMatrixAuxUpdateVisibleSize(Ihandle* ih, int m)[m + p->visible_size = p->total_size;[m + [m + if (p->total_size)[m +[31m- IupSetfAttribute(ih, D, "%f", (double)p->visible_size/(double)p->total_size);[m +[32m+[m[32m IupSetfAttribute(ih, D, "%g", (double)p->visible_size/(double)p->total_size);[m + else[m + IupSetAttribute(ih, D, "1.0");[m + }[m +[36m@@ -390,6 +487,7 @@[m [mvoid iupMatrixAuxCalcSizes(Ihandle* ih)[m + /* when removing lines the first can be positioned after the last line */[m + if (ih->data->lines.first > ih->data->lines.num-1) [m + {[m +[32m+[m[32m ih->data->lines.first_offset = 0;[m + if (ih->data->lines.num==1)[m + ih->data->lines.first = 1;[m + else[m +[36m@@ -397,46 +495,50 @@[m [mvoid iupMatrixAuxCalcSizes(Ihandle* ih)[m + }[m + if (ih->data->columns.first > ih->data->columns.num-1) [m + {[m +[32m+[m[32m ih->data->columns.first_offset = 0;[m + if (ih->data->columns.num == 1)[m + ih->data->columns.first = 1;[m + else[m + ih->data->columns.first = ih->data->columns.num-1;[m + }[m + [m +[31m- iupMatrixAuxUpdateVisiblePos(ih, IMAT_PROCESS_COL);[m +[31m- iupMatrixAuxUpdateVisiblePos(ih, IMAT_PROCESS_LIN);[m +[32m+[m[32m /* make sure scroll pos is consistent */[m +[32m+[m[32m iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_COL);[m +[32m+[m[32m iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_LIN);[m + [m + ih->data->need_calcsize = 0;[m + }[m + [m + int iupMatrixAuxGetLinColFromXY(Ihandle* ih, int x, int y, int* l, int* c)[m + {[m +[31m- int size, lin, col;[m +[32m+[m[32m int x_col, y_col, lin, col;[m + [m +[31m- size = ih->data->columns.sizes[0]; /* always visible when non zero */[m +[31m- if (x < size)[m +[32m+[m[32m x_col = ih->data->columns.sizes[0]; /* always visible when non zero */[m +[32m+[m[32m if (x < x_col)[m + col = 0; /* It is in the column of titles */[m + else[m + {[m +[32m+[m[32m x_col -= ih->data->columns.first_offset;[m + for(col = ih->data->columns.first; col <= ih->data->columns.last; col++) /* for all visible columns */[m + {[m +[31m- size += ih->data->columns.sizes[col];[m +[31m- if (x < size)[m +[32m+[m[32m x_col += ih->data->columns.sizes[col];[m +[32m+[m[32m if (x < x_col)[m + break;[m + }[m + if (col > ih->data->columns.last)[m + col = -1;[m + }[m + [m +[31m- size = ih->data->lines.sizes[0]; /* always visible when non zero */[m +[31m- if (y < size)[m +[32m+[m[32m y_col = ih->data->lines.sizes[0]; /* always visible when non zero */[m +[32m+[m[32m if (y < y_col)[m + lin = 0; /* It is in the line of titles */[m + else[m + {[m +[32m+[m[32m y_col -= ih->data->lines.first_offset;[m + for(lin = ih->data->lines.first; lin <= ih->data->lines.last; lin++) /* for all visible lines */[m + {[m +[31m- size += ih->data->lines.sizes[lin];[m +[31m- if (y < size)[m +[32m+[m[32m y_col += ih->data->lines.sizes[lin];[m +[32m+[m[32m if (y < y_col)[m + break;[m + }[m + if(lin > ih->data->lines.last)[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_aux.h b/iup/srccontrols/matrix/iupmat_aux.h[m +[1mindex 296c1f5..01c77f1 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_aux.h[m +[1m+++ b/iup/srccontrols/matrix/iupmat_aux.h[m +[36m@@ -12,19 +12,22 @@[m + extern "C" {[m + #endif[m + [m +[31m-int iupMatrixAuxIsCellFullVisible(Ihandle* ih, int lin, int col);[m +[32m+[m[32mint iupMatrixAuxIsFullVisibleLast(ImatLinColData *p);[m +[32m+[m[32mint iupMatrixAuxIsCellStartVisible(Ihandle* ih, int lin, int col);[m + int iupMatrixAuxIsCellVisible(Ihandle* ih, int lin, int col);[m + void iupMatrixAuxGetVisibleCellDim (Ihandle* ih, int lin, int col, int* x, int* y, int* w, int* h);[m + [m + void iupMatrixAuxCalcSizes(Ihandle* ih);[m + [m +[31m-void iupMatrixAuxUpdateVisiblePos(Ihandle* ih, int m);[m +[32m+[m[32mvoid iupMatrixAuxAdjustFirstFromLast(ImatLinColData* p);[m +[32m+[m[32mvoid iupMatrixAuxAdjustFirstFromScrollPos(ImatLinColData* p, int scroll_pos);[m +[32m+[m[32mvoid iupMatrixAuxUpdateScrollPos(Ihandle* ih, int m);[m + void iupMatrixAuxUpdateLast(ImatLinColData *p);[m + [m + int iupMatrixAuxGetColumnWidth(Ihandle* ih, int col);[m + int iupMatrixAuxGetLineHeight (Ihandle* ih, int lin);[m + [m +[31m-int iupMatrixAuxGetLinColFromXY (Ihandle* ih, int x, int y, int* l, int* c);[m +[32m+[m[32mint iupMatrixAuxGetLinColFromXY (Ihandle* ih, int x, int y, int* l, int* c);[m + [m + int iupMatrixAuxCallLeaveCellCb (Ihandle* ih);[m + void iupMatrixAuxCallEnterCellCb (Ihandle* ih);[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_cd.h b/iup/srccontrols/matrix/iupmat_cd.h[m +[1mindex 1a10f2b..beb616a 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_cd.h[m +[1m+++ b/iup/srccontrols/matrix/iupmat_cd.h[m +[36m@@ -11,12 +11,12 @@[m + extern "C" {[m + #endif[m + [m +[31m-#define IUPMAT_LINE(_ih,_x1,_y1,_x2,_y2) cdCanvasLine((_ih)->data->cddbuffer, (_x1), iupMatrixInvertYAxis(_ih, _y1), (_x2), iupMatrixInvertYAxis(_ih, _y2))[m +[31m-#define IUPMAT_VERTEX(_ih,_x,_y) cdCanvasVertex((_ih)->data->cddbuffer, (_x), iupMatrixInvertYAxis(_ih, _y))[m +[31m-#define IUPMAT_BOX(_ih,_xmin,_xmax,_ymin,_ymax) cdCanvasBox((_ih)->data->cddbuffer, (_xmin), (_xmax), iupMatrixInvertYAxis(_ih, _ymin), iupMatrixInvertYAxis(_ih, _ymax))[m +[31m-#define IUPMAT_RECT(_ih,_xmin,_xmax,_ymin,_ymax) cdCanvasRect((_ih)->data->cddbuffer, (_xmin), (_xmax), iupMatrixInvertYAxis(_ih, _ymin), iupMatrixInvertYAxis(_ih, _ymax))[m +[31m-#define IUPMAT_CLIPAREA(_ih,_xmin,_xmax,_ymin,_ymax) cdCanvasClipArea((_ih)->data->cddbuffer, (_xmin), (_xmax), iupMatrixInvertYAxis(_ih, _ymin), iupMatrixInvertYAxis(_ih, _ymax))[m +[31m-#define IUPMAT_TEXT(_ih,_x,_y,_text) cdCanvasText((_ih)->data->cddbuffer, (_x), iupMatrixInvertYAxis(_ih, _y), (_text))[m +[32m+[m[32m#define iupMATRIX_LINE(_ih,_x1,_y1,_x2,_y2) cdCanvasLine((_ih)->data->cddbuffer, (_x1), iupMATRIX_INVERTYAXIS(_ih, _y1), (_x2), iupMATRIX_INVERTYAXIS(_ih, _y2))[m +[32m+[m[32m#define iupMATRIX_VERTEX(_ih,_x,_y) cdCanvasVertex((_ih)->data->cddbuffer, (_x), iupMATRIX_INVERTYAXIS(_ih, _y))[m +[32m+[m[32m#define iupMATRIX_BOX(_ih,_xmin,_xmax,_ymin,_ymax) cdCanvasBox((_ih)->data->cddbuffer, (_xmin), (_xmax), iupMATRIX_INVERTYAXIS(_ih, _ymin), iupMATRIX_INVERTYAXIS(_ih, _ymax))[m +[32m+[m[32m#define iupMATRIX_RECT(_ih,_xmin,_xmax,_ymin,_ymax) cdCanvasRect((_ih)->data->cddbuffer, (_xmin), (_xmax), iupMATRIX_INVERTYAXIS(_ih, _ymin), iupMATRIX_INVERTYAXIS(_ih, _ymax))[m +[32m+[m[32m#define iupMATRIX_CLIPAREA(_ih,_xmin,_xmax,_ymin,_ymax) cdCanvasClipArea((_ih)->data->cddbuffer, (_xmin), (_xmax), iupMATRIX_INVERTYAXIS(_ih, _ymin), iupMATRIX_INVERTYAXIS(_ih, _ymax))[m +[32m+[m[32m#define iupMATRIX_TEXT(_ih,_x,_y,_text) cdCanvasText((_ih)->data->cddbuffer, (_x), iupMATRIX_INVERTYAXIS(_ih, _y), (_text))[m + [m + #ifdef __cplusplus[m + }[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_colres.c b/iup/srccontrols/matrix/iupmat_colres.c[m +[1mindex d44b7df..79f389e 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_colres.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_colres.c[m +[36m@@ -34,15 +34,17 @@[m + if so the resize is started */[m + int iupMatrixColResStart(Ihandle* ih, int x, int y)[m + {[m +[31m- if (ih->data->lines.sizes[0] && y < ih->data->lines.sizes[0] && iupAttribGetBoolean(ih, "RESIZEMATRIX"))[m +[32m+[m[32m if (ih->data->lines.sizes[0] &&[m[41m [m +[32m+[m[32m y < ih->data->lines.sizes[0] &&[m[41m [m +[32m+[m[32m iupAttribGetBoolean(ih, "RESIZEMATRIX"))[m + {[m +[31m- int size, col;[m +[32m+[m[32m int x_col, col;[m + [m + /* Check if is the column of titles */[m +[31m- size = ih->data->columns.sizes[0];[m +[31m- if (abs(size-x) < IMAT_COLRES_TOL)[m +[32m+[m[32m x_col = ih->data->columns.sizes[0];[m +[32m+[m[32m if (abs(x_col-x) < IMAT_COLRES_TOL)[m + {[m +[31m- ih->data->colres_drag_col_start_x = 0;[m +[32m+[m[32m ih->data->colres_drag_col_start_x = x;[m + ih->data->colres_dragging = 1;[m + ih->data->colres_drag_col_last_x = -1;[m + ih->data->colres_drag_col = 0;[m +[36m@@ -51,12 +53,13 @@[m [mint iupMatrixColResStart(Ihandle* ih, int x, int y)[m + else[m + {[m + /* find the column */[m +[32m+[m[32m x_col -= ih->data->columns.first_offset;[m + for(col = ih->data->columns.first; col <= ih->data->columns.last; col++)[m + {[m +[31m- ih->data->colres_drag_col_start_x = size;[m +[31m- size += ih->data->columns.sizes[col];[m +[31m- if (abs(size-x) < IMAT_COLRES_TOL)[m +[32m+[m[32m x_col += ih->data->columns.sizes[col];[m +[32m+[m[32m if (abs(x_col-x) < IMAT_COLRES_TOL)[m + {[m +[32m+[m[32m ih->data->colres_drag_col_start_x = x;[m + ih->data->colres_dragging = 1;[m + ih->data->colres_drag_col_last_x = -1;[m + ih->data->colres_drag_col = col;[m +[36m@@ -71,7 +74,8 @@[m [mint iupMatrixColResStart(Ihandle* ih, int x, int y)[m + void iupMatrixColResFinish(Ihandle* ih, int x)[m + {[m + char str[100];[m +[31m- int width = x - ih->data->colres_drag_col_start_x;[m +[32m+[m[32m int delta = x - ih->data->colres_drag_col_start_x;[m +[32m+[m[32m int width = ih->data->columns.sizes[ih->data->colres_drag_col] + delta;[m + if (width < 0)[m + width = 0;[m + [m +[36m@@ -83,8 +87,8 @@[m [mvoid iupMatrixColResFinish(Ihandle* ih, int x)[m + [m + cdCanvasWriteMode(ih->data->cdcanvas, CD_XOR);[m + cdCanvasForeground(ih->data->cdcanvas, IMAT_RESIZE_COLOR); [m +[31m- cdCanvasLine(ih->data->cdcanvas, ih->data->colres_drag_col_last_x, iupMatrixInvertYAxis(ih, y1), [m +[31m- ih->data->colres_drag_col_last_x, iupMatrixInvertYAxis(ih, y2));[m +[32m+[m[32m cdCanvasLine(ih->data->cdcanvas, ih->data->colres_drag_col_last_x, iupMATRIX_INVERTYAXIS(ih, y1),[m[41m [m +[32m+[m[32m ih->data->colres_drag_col_last_x, iupMATRIX_INVERTYAXIS(ih, y2));[m + cdCanvasWriteMode(ih->data->cdcanvas, CD_REPLACE);[m + }[m + [m +[36m@@ -106,7 +110,8 @@[m [mvoid iupMatrixColResMove(Ihandle* ih, int x)[m + {[m + int y1, y2;[m + [m +[31m- int width = x - ih->data->colres_drag_col_start_x;[m +[32m+[m[32m int delta = x - ih->data->colres_drag_col_start_x;[m +[32m+[m[32m int width = ih->data->columns.sizes[ih->data->colres_drag_col] + delta;[m + if (width < 0)[m + return;[m + [m +[36m@@ -119,12 +124,12 @@[m [mvoid iupMatrixColResMove(Ihandle* ih, int x)[m + /* If it is not the first time, move old line */[m + if (ih->data->colres_drag_col_last_x != -1)[m + {[m +[31m- cdCanvasLine(ih->data->cdcanvas, ih->data->colres_drag_col_last_x, iupMatrixInvertYAxis(ih, y1), [m +[31m- ih->data->colres_drag_col_last_x, iupMatrixInvertYAxis(ih, y2));[m +[32m+[m[32m cdCanvasLine(ih->data->cdcanvas, ih->data->colres_drag_col_last_x, iupMATRIX_INVERTYAXIS(ih, y1),[m[41m [m +[32m+[m[32m ih->data->colres_drag_col_last_x, iupMATRIX_INVERTYAXIS(ih, y2));[m + }[m + [m +[31m- cdCanvasLine(ih->data->cdcanvas, x, iupMatrixInvertYAxis(ih, y1), [m +[31m- x, iupMatrixInvertYAxis(ih, y2));[m +[32m+[m[32m cdCanvasLine(ih->data->cdcanvas, x, iupMATRIX_INVERTYAXIS(ih, y1),[m[41m [m +[32m+[m[32m x, iupMATRIX_INVERTYAXIS(ih, y2));[m + [m + ih->data->colres_drag_col_last_x = x;[m + cdCanvasWriteMode(ih->data->cdcanvas, CD_REPLACE);[m +[36m@@ -144,20 +149,23 @@[m [mstatic void iMatrixColResResetMatrixCursor(Ihandle* ih)[m + /* Change the cursor when it passes over a group of the column titles. */[m + void iupMatrixColResCheckChangeCursor(Ihandle* ih, int x, int y)[m + {[m +[31m- if(ih->data->lines.sizes[0] && y < ih->data->lines.sizes[0] && iupAttribGetBoolean(ih, "RESIZEMATRIX"))[m +[32m+[m[32m if(ih->data->lines.sizes[0] &&[m[41m [m +[32m+[m[32m y < ih->data->lines.sizes[0] &&[m[41m [m +[32m+[m[32m iupAttribGetBoolean(ih, "RESIZEMATRIX"))[m + {[m + /* It is in the column titles area and the resize mode is on */[m +[31m- int found = 0, size, col;[m +[32m+[m[32m int found = 0, x_col, col;[m + [m +[31m- size = ih->data->columns.sizes[0];[m +[31m- if (abs(size - x) < IMAT_COLRES_TOL)[m +[32m+[m[32m x_col = ih->data->columns.sizes[0];[m +[32m+[m[32m if (abs(x_col - x) < IMAT_COLRES_TOL)[m + found = 1; /* line titles */[m + else[m + {[m +[32m+[m[32m x_col -= ih->data->columns.first_offset;[m + for(col = ih->data->columns.first; col <= ih->data->columns.last && !found; col++)[m + {[m +[31m- size += ih->data->columns.sizes[col];[m +[31m- if(abs(size - x) < IMAT_COLRES_TOL)[m +[32m+[m[32m x_col += ih->data->columns.sizes[col];[m +[32m+[m[32m if(abs(x_col - x) < IMAT_COLRES_TOL)[m + found = 1;[m + }[m + }[m +[36m@@ -168,7 +176,7 @@[m [mvoid iupMatrixColResCheckChangeCursor(Ihandle* ih, int x, int y)[m + iupAttribStoreStr(ih, "_IUPMAT_CURSOR", IupGetAttribute(ih, "CURSOR"));[m + IupSetAttribute(ih, "CURSOR", "RESIZE_W");[m + }[m +[31m- else /* It is in the empty area after the last column */[m +[32m+[m[32m else /* It is in the empty area after the last column, or inside a cell */[m + iMatrixColResResetMatrixCursor(ih); [m + }[m + else[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_def.h b/iup/srccontrols/matrix/iupmat_def.h[m +[1mindex d45acde..225cc16 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_def.h[m +[1m+++ b/iup/srccontrols/matrix/iupmat_def.h[m +[36m@@ -49,6 +49,7 @@[m [mtypedef struct _ImatLinColData[m + int num; /* Number of columns/lines in the matrix, default/minimum=1, always includes the title */[m + int num_alloc; /* Number of columns/lines allocated, default=5 */[m + [m +[32m+[m[32m int first_offset; /* scroll offset of the first visible column/line from right to left (or the invisible part of the first cell) */[m + int first; /* First visible column/line */[m + int last; /* Last visible column/line */[m + [m +[36m@@ -84,7 +85,7 @@[m [mstruct _IcontrolData[m + [m + /* attributes */[m + int mark_continuous, mark_mode, mark_multiple;[m +[31m- int checkframecolor;[m +[32m+[m[32m int checkframecolor, hidden_text_marks;[m + [m + /* Mouse and Keyboard AUX */[m + int leftpressed; /* left mouse button is pressed */[m +[36m@@ -92,8 +93,8 @@[m [mstruct _IcontrolData[m + [m + /* ColRes AUX */[m + int colres_dragging, /* indicates if it is being made a column resize */[m +[31m- colres_drag_col, /* column being resized */[m +[31m- colres_drag_col_start_x, /* position of the start of the column being resized */[m +[32m+[m[32m colres_drag_col, /* column being resized, handler is at right of the column */[m +[32m+[m[32m colres_drag_col_start_x, /* handler start position */[m + colres_drag_col_last_x; /* previous position */[m + [m + /* Mark AUX */[m +[36m@@ -107,12 +108,14 @@[m [mstruct _IcontrolData[m + IFniiIII fgcolor_cb;[m + IFniiIII bgcolor_cb;[m + char *bgcolor, *bgcolor_parent, *fgcolor, *font; /* not need to free */[m +[32m+[m +[32m+[m[32m int clip_x1, clip_x2, clip_y1, clip_y2; /* aux for cell clipping */[m + };[m + [m + [m + int iupMatrixIsValid(Ihandle* ih, int check_cells);[m + [m +[31m-#define iupMatrixInvertYAxis(_ih, _y) ((_ih)->data->h-1 - (_y))[m +[32m+[m[32m#define iupMATRIX_INVERTYAXIS(_ih, _y) ((_ih)->data->h-1 - (_y))[m + [m + [m + #ifdef __cplusplus[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_draw.c b/iup/srccontrols/matrix/iupmat_draw.c[m +[1mindex 7c53fb5..ec3df59 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_draw.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_draw.c[m +[36m@@ -47,13 +47,38 @@[m + #define IMAT_COMBOBOX_W 16[m + [m + [m +[31m-typedef int (*IFniiiiiiC)(Ihandle *h, int lin, int col,int x1, int x2, int y1, int y2, cdCanvas* cnv);[m +[32m+[m[32mtypedef int (*IFniiiiiiC)(Ihandle *h, int lin, int col, int x1, int x2, int y1, int y2, cdCanvas* cnv);[m + [m + [m + /**************************************************************************/[m + /* Private functions */[m + /**************************************************************************/[m + [m +[32m+[m[32mstatic void iMatrixDrawSetCellClipping(Ihandle* ih, int x1, int x2, int y1, int y2)[m +[32m+[m[32m{[m +[32m+[m[32m int old_clip = cdCanvasClip(ih->data->cddbuffer, CD_QUERY);[m +[32m+[m[32m if (old_clip == CD_CLIPAREA)[m +[32m+[m[32m {[m +[32m+[m[32m cdCanvasGetClipArea(ih->data->cddbuffer, &(ih->data->clip_x1), &(ih->data->clip_x2), &(ih->data->clip_y1), &(ih->data->clip_y2));[m +[32m+[m[32m y1 = iupMATRIX_INVERTYAXIS(ih, y1);[m +[32m+[m[32m y2 = iupMATRIX_INVERTYAXIS(ih, y2);[m +[32m+[m[32m if (x1 > x2) {int tmp = x1; x1 = x2; x2 = tmp;}[m +[32m+[m[32m if (y1 > y2) {int tmp = y1; y1 = y2; y2 = tmp;}[m +[32m+[m[32m if (x1 < ih->data->clip_x1) x1 = ih->data->clip_x1;[m +[32m+[m[32m if (x2 > ih->data->clip_x2) x2 = ih->data->clip_x2;[m +[32m+[m[32m if (y1 < ih->data->clip_y1) y1 = ih->data->clip_y1;[m +[32m+[m[32m if (y2 > ih->data->clip_y2) y2 = ih->data->clip_y2;[m +[32m+[m[32m cdCanvasClipArea(ih->data->cddbuffer, x1, x2, y1, y2);[m +[32m+[m[32m cdCanvasClip(ih->data->cddbuffer, CD_CLIPAREA);[m +[32m+[m[32m }[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void iMatrixDrawResetCellClipping(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m int old_clip = cdCanvasClip(ih->data->cddbuffer, CD_QUERY);[m +[32m+[m[32m if (old_clip == CD_CLIPAREA)[m +[32m+[m[32m cdCanvasClipArea(ih->data->cddbuffer, ih->data->clip_x1, ih->data->clip_x2, ih->data->clip_y1, ih->data->clip_y2);[m +[32m+[m[32m}[m + [m + static int iMatrixDrawGetColAlignment(Ihandle* ih, int col, char* str)[m + {[m +[36m@@ -61,6 +86,8 @@[m [mstatic int iMatrixDrawGetColAlignment(Ihandle* ih, int col, char* str)[m + sprintf(str, "ALIGNMENT%d", col);[m + align = iupAttribGet(ih, str);[m + if (!align)[m +[32m+[m[32m align = iupAttribGet(ih, "ALIGNMENT");[m +[32m+[m[32m if (!align)[m + {[m + if (col == 0)[m + return IMAT_T_LEFT;[m +[36m@@ -80,16 +107,15 @@[m [mstatic int iMatrixDrawCallDrawCB(Ihandle* ih, int lin, int col, int x1, int x2,[m + int ret;[m + cdCanvas* old_cnv;[m + [m +[31m- IUPMAT_CLIPAREA(ih, x1, x2, y1, y2);[m +[31m- cdCanvasClip(ih->data->cddbuffer, CD_CLIPAREA);[m +[32m+[m[32m iMatrixDrawSetCellClipping(ih, x1, x2, y1, y2);[m + [m + old_cnv = cdActiveCanvas();[m + if (old_cnv != ih->data->cddbuffer) /* backward compatibility code */[m + cdActivate(ih->data->cddbuffer);[m + [m +[31m- ret = draw_cb(ih, lin, col, x1, x2, iupMatrixInvertYAxis(ih, y1), iupMatrixInvertYAxis(ih, y2), ih->data->cddbuffer);[m +[32m+[m[32m ret = draw_cb(ih, lin, col, x1, x2, iupMATRIX_INVERTYAXIS(ih, y1), iupMATRIX_INVERTYAXIS(ih, y2), ih->data->cddbuffer);[m + [m +[31m- cdCanvasClip(ih->data->cddbuffer, CD_CLIPOFF);[m +[32m+[m[32m iMatrixDrawResetCellClipping(ih);[m + [m + if (old_cnv && old_cnv != ih->data->cddbuffer) /* backward compatibility code */[m + {[m +[36m@@ -165,28 +191,36 @@[m [mstatic void iMatrixDrawFrameHorizLineCell(Ihandle* ih, int lin, int col, int x1,[m + {[m + if (ih->data->checkframecolor && (ih->data->callback_mode || ih->data->cells[lin][col].flags & IUPMAT_FRAMEHCOLOR))[m + {[m +[32m+[m[32m char* color;[m + unsigned char r,g,b;[m + sprintf(str, "FRAMEHORIZCOLOR%d:%d", lin, col);[m +[31m- if (iupStrToRGB(iupAttribGet(ih, str), &r, &g, &b))[m +[32m+[m[32m color = iupAttribGet(ih, str);[m +[32m+[m[32m if (iupStrEqual(color, "BGCOLOR"))[m +[32m+[m[32m return;[m +[32m+[m[32m if (iupStrToRGB(color, &r, &g, &b))[m + framecolor = cdEncodeColor(r, g, b);[m + }[m + [m + cdCanvasForeground(ih->data->cddbuffer, framecolor);[m +[31m- IUPMAT_LINE(ih, x1, y, x2, y); /* bottom horizontal line */[m +[32m+[m[32m iupMATRIX_LINE(ih, x1, y, x2, y); /* bottom horizontal line */[m + }[m + [m + static void iMatrixDrawFrameVertLineCell(Ihandle* ih, int lin, int col, int x, int y1, int y2, long framecolor, char* str)[m + {[m + if (ih->data->checkframecolor && (ih->data->callback_mode || ih->data->cells[lin][col].flags & IUPMAT_FRAMEVCOLOR))[m + {[m +[32m+[m[32m char* color;[m + unsigned char r,g,b;[m + sprintf(str, "FRAMEVERTCOLOR%d:%d", lin, col);[m +[31m- if (iupStrToRGB(iupAttribGet(ih, str), &r, &g, &b))[m +[32m+[m[32m color = iupAttribGet(ih, str);[m +[32m+[m[32m if (iupStrEqual(color, "BGCOLOR"))[m +[32m+[m[32m return;[m +[32m+[m[32m if (iupStrToRGB(color, &r, &g, &b))[m + framecolor = cdEncodeColor(r, g, b);[m + }[m + [m + cdCanvasForeground(ih->data->cddbuffer, framecolor);[m +[31m- IUPMAT_LINE(ih, x, y1, x, y2); /* right vertical line */[m +[32m+[m[32m iupMATRIX_LINE(ih, x, y1, x, y2); /* right vertical line */[m + }[m + [m + static void iMatrixDrawFrameRectTitle(Ihandle* ih, int lin, int col, int x1, int x2, int y1, int y2, long framecolor, char* str)[m +[36m@@ -195,37 +229,43 @@[m [mstatic void iMatrixDrawFrameRectTitle(Ihandle* ih, int lin, int col, int x1, int[m + x2 -= IMAT_FRAME_W/2;[m + y2 -= IMAT_FRAME_H/2;[m + [m +[31m- iMatrixDrawFrameVertLineCell(ih, lin, col, x2, y1, y2, framecolor, str); /* right vertical line */[m +[32m+[m[32m /* right vertical line */[m +[32m+[m[32m iMatrixDrawFrameVertLineCell(ih, lin, col, x2, y1, y2, framecolor, str);[m[41m [m + if (col==0)[m + {[m +[31m- IUPMAT_LINE(ih, x1, y1, x1, y2); /* left vertical line, reuse Foreground */[m +[32m+[m[32m /* left vertical line, reuse Foreground */[m +[32m+[m[32m iupMATRIX_LINE(ih, x1, y1, x1, y2);[m[41m [m + x1++;[m + }[m + else if (col==1 && ih->data->columns.sizes[0] == 0)[m + {[m + /* If does not have line titles then draw the left line of the cell frame */[m +[31m- IUPMAT_LINE(ih, x1, y1, x1, y2-1);[m +[32m+[m[32m iupMATRIX_LINE(ih, x1, y1, x1, y2-1);[m + x1++;[m + }[m + [m +[31m- cdCanvasForeground(ih->data->cddbuffer, CD_WHITE); /* Titles have a white line near the frame */[m +[31m- IUPMAT_LINE(ih, x1, y1+1, x1, y2-1);[m +[32m+[m[32m /* Titles have a white line near the frame, at left */[m +[32m+[m[32m cdCanvasForeground(ih->data->cddbuffer, CD_WHITE);[m[41m [m +[32m+[m[32m iupMATRIX_LINE(ih, x1, y1+1, x1, y2-1);[m + [m +[31m- iMatrixDrawFrameHorizLineCell(ih, lin, col, x1, x2, y2, framecolor, str); /* bottom horizontal line */[m +[32m+[m[32m /* bottom horizontal line */[m +[32m+[m[32m iMatrixDrawFrameHorizLineCell(ih, lin, col, x1, x2, y2, framecolor, str);[m[41m [m + if (lin==0)[m + {[m +[31m- IUPMAT_LINE(ih, x1, y1, x2, y1); /* top horizontal line, reuse Foreground */[m +[32m+[m[32m /* top horizontal line, reuse Foreground */[m +[32m+[m[32m iupMATRIX_LINE(ih, x1, y1, x2, y1);[m[41m [m + y1++;[m + }[m + else if (lin==1 && ih->data->lines.sizes[0] == 0)[m + {[m + /* If does not have column titles then draw the top line of the cell frame */[m +[31m- IUPMAT_LINE(ih, x1, y1, x2-1, y1);[m +[32m+[m[32m iupMATRIX_LINE(ih, x1, y1, x2-1, y1);[m + y1++;[m + }[m + [m +[31m- cdCanvasForeground(ih->data->cddbuffer, CD_WHITE); /* Titles have a white line near the frame */[m +[31m- IUPMAT_LINE(ih, x1, y1, x2-1, y1);[m +[32m+[m[32m /* Titles have a white line near the frame, at top */[m +[32m+[m[32m cdCanvasForeground(ih->data->cddbuffer, CD_WHITE);[m[41m [m +[32m+[m[32m iupMATRIX_LINE(ih, x1, y1, x2-1, y1);[m + }[m + [m + static void iMatrixDrawFrameRectCell(Ihandle* ih, int lin, int col, int x1, int x2, int y1, int y2, long framecolor, char* str)[m +[36m@@ -233,20 +273,20 @@[m [mstatic void iMatrixDrawFrameRectCell(Ihandle* ih, int lin, int col, int x1, int[m + if (col==1 && ih->data->columns.sizes[0] == 0)[m + {[m + /* If does not have line titles then draw the left line of the cell frame */[m +[31m- iMatrixDrawFrameVertLineCell(ih, lin, col, x1, y1, y2-1-1, framecolor, str);[m +[32m+[m[32m iMatrixDrawFrameVertLineCell(ih, lin, col, x1, y1, y2-1, framecolor, str);[m + }[m + [m + if (lin==1 && ih->data->lines.sizes[0] == 0)[m + {[m + /* If does not have column titles then draw the top line of the cell frame */[m +[31m- iMatrixDrawFrameHorizLineCell(ih, lin, col, x1, x2-1-1, y1, framecolor, str);[m +[32m+[m[32m iMatrixDrawFrameHorizLineCell(ih, lin, col, x1, x2-1, y1, framecolor, str);[m + }[m + [m + /* bottom line */[m + iMatrixDrawFrameHorizLineCell(ih, lin, col, x1, x2-1, y2-1, framecolor, str);[m + [m + /* rigth line */[m +[31m- iMatrixDrawFrameVertLineCell(ih, lin, col, x2-1, y1, y2-1, framecolor, str);[m +[32m+[m[32m iMatrixDrawFrameVertLineCell(ih, lin, col, x2-1, y1, y2-2, framecolor, str);[m + }[m + [m + static int iMatrixDrawSortSign(Ihandle* ih, int x2, int y1, int y2, int col, int active, char* str)[m +[36m@@ -274,15 +314,15 @@[m [mstatic int iMatrixDrawSortSign(Ihandle* ih, int x2, int y1, int y2, int col, int[m + [m + if (iupStrEqualNoCase(sort, "DOWN"))[m + {[m +[31m- IUPMAT_VERTEX(ih, x2 - 5, yc + 2);[m +[31m- IUPMAT_VERTEX(ih, x2 - 1, yc - 2);[m +[31m- IUPMAT_VERTEX(ih, x2 - 9, yc - 2);[m +[32m+[m[32m iupMATRIX_VERTEX(ih, x2 - 5, yc + 2);[m +[32m+[m[32m iupMATRIX_VERTEX(ih, x2 - 1, yc - 2);[m +[32m+[m[32m iupMATRIX_VERTEX(ih, x2 - 9, yc - 2);[m + }[m + else[m + {[m +[31m- IUPMAT_VERTEX(ih, x2 - 1, yc + 2);[m +[31m- IUPMAT_VERTEX(ih, x2 - 9, yc + 2);[m +[31m- IUPMAT_VERTEX(ih, x2 - 5, yc - 2);[m +[32m+[m[32m iupMATRIX_VERTEX(ih, x2 - 1, yc + 2);[m +[32m+[m[32m iupMATRIX_VERTEX(ih, x2 - 9, yc + 2);[m +[32m+[m[32m iupMATRIX_VERTEX(ih, x2 - 5, yc - 2);[m + }[m + [m + cdCanvasEnd(ih->data->cddbuffer);[m +[36m@@ -301,20 +341,20 @@[m [mstatic void iMatrixDrawComboFeedback(Ihandle* ih, int x2, int y1, int y2, int ac[m + [m + /* feedback background */[m + iMatrixDrawSetBgColor(ih, 0, 0, 0, active);[m +[31m- IUPMAT_BOX(ih, x1, x2, y1, y2);[m +[32m+[m[32m iupMATRIX_BOX(ih, x1, x2, y1, y2);[m + [m + /* feedback frame */[m + cdCanvasForeground(ih->data->cddbuffer, framecolor);[m +[31m- IUPMAT_RECT(ih, x1, x2, y1, y2);[m +[32m+[m[32m iupMATRIX_RECT(ih, x1, x2, y1, y2);[m + [m + /* feedback arrow */[m + xh2 = x2 - IMAT_COMBOBOX_W / 2;[m + yh2 = y2 - (y2 - y1) / 2;[m + [m + cdCanvasBegin(ih->data->cddbuffer, CD_FILL);[m +[31m- IUPMAT_VERTEX(ih, xh2, yh2 + 3);[m +[31m- IUPMAT_VERTEX(ih, xh2 + 4, yh2 - 1);[m +[31m- IUPMAT_VERTEX(ih, xh2 - 4, yh2 - 1);[m +[32m+[m[32m iupMATRIX_VERTEX(ih, xh2, yh2 + 3);[m +[32m+[m[32m iupMATRIX_VERTEX(ih, xh2 + 4, yh2 - 1);[m +[32m+[m[32m iupMATRIX_VERTEX(ih, xh2 - 4, yh2 - 1);[m + cdCanvasEnd(ih->data->cddbuffer);[m + }[m + [m +[36m@@ -325,7 +365,7 @@[m [mstatic void iMatrixDrawBackground(Ihandle* ih, int x1, int x2, int y1, int y2, i[m + y2 -= IMAT_FRAME_H/2;[m + [m + iMatrixDrawSetBgColor(ih, lin, col, marked, active);[m +[31m- IUPMAT_BOX(ih, x1, x2, y1, y2);[m +[32m+[m[32m iupMATRIX_BOX(ih, x1, x2, y1, y2);[m + }[m + [m + /* Put the cell contents in the screen, using the specified color and alignment.[m +[36m@@ -372,7 +412,7 @@[m [mstatic void iMatrixDrawCellValue(Ihandle* ih, int x1, int x2, int y1, int y2, in[m + if (text && *text)[m + {[m + int num_line, line_height, total_height;[m +[31m- int charheight, ypos;[m +[32m+[m[32m int charheight, ypos, hidden_text_marks = 0;[m + [m + num_line = iupStrLineCount(text);[m + iupdrvFontGetCharSize(ih, NULL, &charheight);[m +[36m@@ -380,12 +420,18 @@[m [mstatic void iMatrixDrawCellValue(Ihandle* ih, int x1, int x2, int y1, int y2, in[m + line_height = charheight;[m + total_height = (line_height + IMAT_PADDING_H/2) * num_line - IMAT_PADDING_H/2 - IMAT_FRAME_H/2;[m + [m +[31m- if (lin==0)[m +[32m+[m[32m if (lin==0 || ih->data->hidden_text_marks)[m + {[m + int text_w;[m + iupdrvFontGetMultiLineStringSize(ih, text, &text_w, NULL);[m + if (text_w > x2 - x1 + 1 - IMAT_PADDING_W - IMAT_FRAME_W)[m +[31m- alignment = IMAT_T_LEFT;[m +[32m+[m[32m {[m +[32m+[m[32m if (lin == 0)[m +[32m+[m[32m alignment = IMAT_T_LEFT;[m +[32m+[m +[32m+[m[32m if (ih->data->hidden_text_marks)[m +[32m+[m[32m hidden_text_marks = 1;[m +[32m+[m[32m }[m + }[m + [m + /* Set the color used to draw the text */[m +[36m@@ -395,8 +441,13 @@[m [mstatic void iMatrixDrawCellValue(Ihandle* ih, int x1, int x2, int y1, int y2, in[m + iMatrixDrawSetFgColor(ih, lin, col, marked);[m + [m + /* Set the clip area to the cell region informed, the text maybe greatter than the cell */[m +[31m- IUPMAT_CLIPAREA(ih, x1, x2, y1, y2);[m +[31m- cdCanvasClip(ih->data->cddbuffer, CD_CLIPAREA);[m +[32m+[m[32m if (hidden_text_marks)[m +[32m+[m[32m {[m +[32m+[m[32m int crop = iupdrvFontGetStringWidth(ih, "...") + 2;[m +[32m+[m[32m iMatrixDrawSetCellClipping(ih, x1, x2-crop, y1, y2);[m +[32m+[m[32m }[m +[32m+[m[32m else[m +[32m+[m[32m iMatrixDrawSetCellClipping(ih, x1, x2, y1, y2);[m + [m + cdCanvasNativeFont(ih->data->cddbuffer, iupMatrixGetFont(ih, lin, col));[m + [m +[36m@@ -417,11 +468,11 @@[m [mstatic void iMatrixDrawCellValue(Ihandle* ih, int x1, int x2, int y1, int y2, in[m + [m + /* Put the text */[m + if (alignment == IMAT_T_CENTER)[m +[31m- IUPMAT_TEXT(ih, (x1 + x2) / 2, ypos, text);[m +[32m+[m[32m iupMATRIX_TEXT(ih, (x1 + x2) / 2, ypos, text);[m + else if(alignment == IMAT_T_LEFT)[m +[31m- IUPMAT_TEXT(ih, x1, ypos, text);[m +[32m+[m[32m iupMATRIX_TEXT(ih, x1, ypos, text);[m + else[m +[31m- IUPMAT_TEXT(ih, x2, ypos, text);[m +[32m+[m[32m iupMATRIX_TEXT(ih, x2, ypos, text);[m + }[m + else[m + {[m +[36m@@ -441,11 +492,11 @@[m [mstatic void iMatrixDrawCellValue(Ihandle* ih, int x1, int x2, int y1, int y2, in[m + [m + /* Draw the text */[m + if(alignment == IMAT_T_CENTER)[m +[31m- IUPMAT_TEXT(ih, (x1 + x2) / 2, ypos, p);[m +[32m+[m[32m iupMATRIX_TEXT(ih, (x1 + x2) / 2, ypos, p);[m + else if(alignment == IMAT_T_LEFT)[m +[31m- IUPMAT_TEXT(ih, x1, ypos, p);[m +[32m+[m[32m iupMATRIX_TEXT(ih, x1, ypos, p);[m + else[m +[31m- IUPMAT_TEXT(ih, x2, ypos, p);[m +[32m+[m[32m iupMATRIX_TEXT(ih, x2, ypos, p);[m + [m + /* Advance the string */[m + if (q) p = q + 1;[m +[36m@@ -457,7 +508,15 @@[m [mstatic void iMatrixDrawCellValue(Ihandle* ih, int x1, int x2, int y1, int y2, in[m + free(newtext);[m + }[m + [m +[31m- cdCanvasClip(ih->data->cddbuffer, CD_CLIPOFF);[m +[32m+[m[32m iMatrixDrawResetCellClipping(ih);[m +[32m+[m +[32m+[m[32m if (hidden_text_marks)[m +[32m+[m[32m {[m +[32m+[m[32m cdCanvasTextAlignment(ih->data->cddbuffer, CD_EAST);[m +[32m+[m[32m ypos = (int)((y1 + y2) / 2.0 - 0.5);[m +[32m+[m[32m iupMATRIX_TEXT(ih, x2+IMAT_PADDING_W/2, ypos, "...");[m +[32m+[m[32m }[m +[32m+[m + }[m + }[m + [m +[36m@@ -522,7 +581,7 @@[m [mstatic void iMatrixDrawFocus(Ihandle* ih)[m + if (ih->data->lines.focus_cell == 1 && ih->data->lines.sizes[0] == 0)[m + y1++;[m + [m +[31m- cdIupDrawFocusRect(ih, ih->data->cdcanvas, x1, iupMatrixInvertYAxis(ih, y1), x2, iupMatrixInvertYAxis(ih, y2));[m +[32m+[m[32m cdIupDrawFocusRect(ih, ih->data->cdcanvas, x1, iupMATRIX_INVERTYAXIS(ih, y1), x2, iupMATRIX_INVERTYAXIS(ih, y2));[m + }[m + [m + [m +[36m@@ -560,6 +619,11 @@[m [mvoid iupMatrixDrawLineTitle(Ihandle* ih, int lin1, int lin2)[m + x2 = ih->data->columns.sizes[0];[m + [m + y1 = ih->data->lines.sizes[0];[m +[32m+[m +[32m+[m[32m iupMATRIX_CLIPAREA(ih, x1, x2, y1, ih->data->h-1);[m +[32m+[m[32m cdCanvasClip(ih->data->cddbuffer, CD_CLIPAREA);[m +[32m+[m +[32m+[m[32m y1 -= ih->data->lines.first_offset;[m + for(lin = ih->data->lines.first; lin < lin1; lin++)[m + y1 += ih->data->lines.sizes[lin];[m + [m +[36m@@ -592,6 +656,8 @@[m [mvoid iupMatrixDrawLineTitle(Ihandle* ih, int lin1, int lin2)[m + [m + y1 = y2;[m + }[m +[32m+[m +[32m+[m[32m cdCanvasClip(ih->data->cddbuffer, CD_CLIPOFF);[m + }[m + [m + /* Draw the column titles, visible, between col and lastcol, include it. [m +[36m@@ -623,6 +689,11 @@[m [mvoid iupMatrixDrawColumnTitle(Ihandle* ih, int col1, int col2)[m + y2 = ih->data->lines.sizes[0];[m + [m + x1 = ih->data->columns.sizes[0];[m +[32m+[m +[32m+[m[32m iupMATRIX_CLIPAREA(ih, x1, ih->data->w-1, y1, y2);[m +[32m+[m[32m cdCanvasClip(ih->data->cddbuffer, CD_CLIPAREA);[m +[32m+[m +[32m+[m[32m x1 -= ih->data->columns.first_offset;[m + for(col = ih->data->columns.first; col < col1; col++)[m + x1 += ih->data->columns.sizes[col];[m + [m +[36m@@ -657,6 +728,8 @@[m [mvoid iupMatrixDrawColumnTitle(Ihandle* ih, int col1, int col2)[m + [m + x1 = x2;[m + }[m +[32m+[m +[32m+[m[32m cdCanvasClip(ih->data->cddbuffer, CD_CLIPOFF);[m + }[m + [m + /* Redraw a block of cells of the matrix. Handle marked cells, change[m +[36m@@ -673,13 +746,11 @@[m [mvoid iupMatrixDrawCells(Ihandle* ih, int lin1, int col1, int lin2, int col2)[m + IFnii dropcheck_cb;[m + IFniiiiiiC draw_cb;[m + [m +[31m- x1 = 0;[m + x2 = ih->data->w-1;[m +[31m- y1 = 0;[m + y2 = ih->data->h-1;[m + [m + old_x2 = x2;[m +[31m- old_y1 = y1;[m +[32m+[m[32m old_y1 = 0;[m + old_y2 = y2;[m + [m + if (col1 > ih->data->columns.last ||[m +[36m@@ -697,8 +768,14 @@[m [mvoid iupMatrixDrawCells(Ihandle* ih, int lin1, int col1, int lin2, int col2)[m + if (lin2 > ih->data->lines.last)[m + lin2 = ih->data->lines.last;[m + [m +[32m+[m[32m x1 = ih->data->columns.sizes[0];[m +[32m+[m[32m y1 = ih->data->lines.sizes[0];[m +[32m+[m +[32m+[m[32m iupMATRIX_CLIPAREA(ih, x1, x2, y1, y2);[m +[32m+[m[32m cdCanvasClip(ih->data->cddbuffer, CD_CLIPOFF); /* wait for background */[m +[32m+[m + /* Find the initial position of the first column */[m +[31m- x1 += ih->data->columns.sizes[0];[m +[32m+[m[32m x1 -= ih->data->columns.first_offset;[m + for(col = ih->data->columns.first; col < col1; col++)[m + x1 += ih->data->columns.sizes[col];[m + [m +[36m@@ -708,7 +785,7 @@[m [mvoid iupMatrixDrawCells(Ihandle* ih, int lin1, int col1, int lin2, int col2)[m + x2 += ih->data->columns.sizes[col];[m + [m + /* Find the initial position of the first line */[m +[31m- y1 += ih->data->lines.sizes[0];[m +[32m+[m[32m y1 -= ih->data->lines.first_offset;[m + for(lin = ih->data->lines.first; lin < lin1; lin++)[m + y1 += ih->data->lines.sizes[lin];[m + [m +[36m@@ -724,7 +801,7 @@[m [mvoid iupMatrixDrawCells(Ihandle* ih, int lin1, int col1, int lin2, int col2)[m + [m + /* If it was drawn until the last column and remains space in the right of it,[m + then delete this area with the the background color. */[m +[31m- IUPMAT_BOX(ih, x2, old_x2, old_y1, old_y2);[m +[32m+[m[32m iupMATRIX_BOX(ih, x2, old_x2, old_y1, old_y2);[m + }[m + [m + if ((lin2 == ih->data->lines.num-1) && (old_y2 > y2))[m +[36m@@ -735,9 +812,12 @@[m [mvoid iupMatrixDrawCells(Ihandle* ih, int lin1, int col1, int lin2, int col2)[m + [m + /* If it was drawn until the last line visible and remains space below it,[m + then delete this area with the the background color. */[m +[31m- IUPMAT_BOX(ih, 0, old_x2, y2, old_y2);[m +[32m+[m[32m iupMATRIX_BOX(ih, 0, old_x2, y2, old_y2);[m + }[m + [m +[32m+[m[32m /* after the background */[m +[32m+[m[32m cdCanvasClip(ih->data->cddbuffer, CD_CLIPAREA);[m +[32m+[m + /***** Draw the cell values and frame */[m + old_y1 = y1;[m + framecolor = cdIupConvertColor(iupAttribGetStr(ih, "FRAMECOLOR"));[m +[36m@@ -775,7 +855,7 @@[m [mvoid iupMatrixDrawCells(Ihandle* ih, int lin1, int col1, int lin2, int col2)[m + [m + if (dropcheck_cb && dropcheck_cb(ih, lin, col) == IUP_DEFAULT)[m + {[m +[31m- drop = IMAT_COMBOBOX_W;[m +[32m+[m[32m drop = IMAT_COMBOBOX_W+IMAT_PADDING_W/2;[m + iMatrixDrawComboFeedback(ih, x2, y1, y2, active, framecolor);[m + }[m + [m +[36m@@ -788,6 +868,8 @@[m [mvoid iupMatrixDrawCells(Ihandle* ih, int lin1, int col1, int lin2, int col2)[m + x1 = x2;[m + y1 = old_y1; /* must reset also y */[m + }[m +[32m+[m +[32m+[m[32m cdCanvasClip(ih->data->cddbuffer, CD_CLIPOFF);[m + }[m + [m + void iupMatrixDraw(Ihandle* ih, int update)[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_edit.c b/iup/srccontrols/matrix/iupmat_edit.c[m +[1mindex a7e0a74..551baed 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_edit.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_edit.c[m +[36m@@ -67,7 +67,7 @@[m [mstatic int iMatrixEditDropDownAction_CB(Ihandle* ih, char* t, int i, int v)[m + if (ret == IUP_CONTINUE)[m + {[m + iupMatrixEditHide(ih_matrix);[m +[31m- iupMatrixDrawUpdate(ih);[m +[32m+[m[32m iupMatrixDrawUpdate(ih_matrix);[m + }[m + }[m + [m +[36m@@ -137,13 +137,31 @@[m [mstatic int iMatrixEditCancel(Ihandle* ih, int focus, int update, int ignore)[m + return IUP_DEFAULT;[m + }[m + [m +[32m+[m[32mstatic int iMatrixEditDropDown_CB(Ihandle* ih, int state)[m +[32m+[m[32m{[m +[32m+[m[32m /* In Motif if DROPDOWN=YES then when the dropdown button is clicked[m[41m [m +[32m+[m[32m the list looses its focus and when the dropped list is closed[m[41m [m +[32m+[m[32m the list regain the focus, also when that happen if the list looses its focus[m[41m [m +[32m+[m[32m to another control the kill focus callback is not called. */[m +[32m+[m[32m Ihandle* ih_matrix = ih->parent;[m +[32m+[m[32m if (state == 1)[m +[32m+[m[32m iupAttribSetStr(ih_matrix, "_IUPMAT_DROPDOWN", "1");[m +[32m+[m +[32m+[m[32m return IUP_DEFAULT;[m +[32m+[m[32m}[m +[32m+[m + static int iMatrixEditKillFocus_CB(Ihandle* ih)[m + {[m + Ihandle* ih_matrix = ih->parent;[m +[31m- if (iupStrEqualNoCase(IupGetGlobal("DRIVER"), "Motif"))[m +[32m+[m[32m if (IupGetGlobal("MOTIFVERSION"))[m + {[m +[31m- if (iupAttribGet(ih_matrix, "_IUPMAT_DOUBLE_CLICK"))[m +[32m+[m[32m if (iupAttribGet(ih_matrix, "_IUPMAT_DROPDOWN") || /* from iMatrixEditDropDown_CB, in Motif */[m +[32m+[m[32m iupAttribGet(ih_matrix, "_IUPMAT_DOUBLECLICK")) /* from iMatrixMouseLeftPress, in Motif */[m +[32m+[m[32m {[m +[32m+[m[32m iupAttribSetStr(ih_matrix, "_IUPMAT_DOUBLECLICK", NULL);[m +[32m+[m[32m iupAttribSetStr(ih_matrix, "_IUPMAT_DROPDOWN", NULL);[m + return IUP_DEFAULT;[m +[32m+[m[32m }[m + }[m + [m + iupMatrixEditForceHidden(ih_matrix);[m +[36m@@ -200,7 +218,7 @@[m [mint iupMatrixEditShow(Ihandle* ih)[m + [m + /* position the cell to make it visible */[m + /* If the focus is not visible, a scroll is done for that the focus to be visible */[m +[31m- if (!iupMatrixAuxIsCellFullVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell))[m +[32m+[m[32m if (!iupMatrixAuxIsCellStartVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell))[m + iupMatrixScrollToVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell);[m + [m + /* set attributes */[m +[36m@@ -235,7 +253,7 @@[m [mint iupMatrixEditShow(Ihandle* ih)[m + ih->data->datah->y = y;[m + if (IupGetGlobal("GTKVERSION"))[m + {[m +[31m- /* In GTK, IupCanvas is not the actual container of the IupText/IupList */[m +[32m+[m[32m /* In GTK, IupCanvas is NOT the actual container of the IupText/IupList */[m + ih->data->datah->x += ih->x;[m + ih->data->datah->y += ih->y;[m + }[m +[36m@@ -366,7 +384,7 @@[m [mstatic int iMatrixEditTextKeyAny_CB(Ihandle* ih, int c)[m + [m + if (iupMatrixAuxCallLeaveCellCb(ih_matrix) != IUP_IGNORE)[m + {[m +[31m- iupMatrixScrollKeyCr(ih_matrix);[m +[32m+[m[32m iupMATRIX_ScrollKeyCr(ih_matrix);[m + iupMatrixAuxCallEnterCellCb(ih_matrix);[m + }[m + iupMatrixDrawUpdate(ih_matrix);[m +[36m@@ -399,7 +417,7 @@[m [mstatic int iMatrixEditDropDownKeyAny_CB(Ihandle* ih, int c)[m + {[m + if (iupMatrixAuxCallLeaveCellCb(ih_matrix) != IUP_IGNORE)[m + {[m +[31m- iupMatrixScrollKeyCr(ih_matrix);[m +[32m+[m[32m iupMATRIX_ScrollKeyCr(ih_matrix);[m + iupMatrixAuxCallEnterCellCb(ih_matrix);[m + }[m + iupMatrixDrawUpdate(ih_matrix);[m +[36m@@ -440,6 +458,9 @@[m [mvoid iupMatrixEditCreate(Ihandle* ih)[m + ih->data->droph = IupList(NULL);[m + iupChildTreeAppend(ih, ih->data->droph);[m + [m +[32m+[m[32m if (IupGetGlobal("MOTIFVERSION"))[m +[32m+[m[32m IupSetCallback(ih->data->droph, "DROPDOWN_CB", (Icallback)iMatrixEditDropDown_CB);[m +[32m+[m + IupSetCallback(ih->data->droph, "ACTION", (Icallback)iMatrixEditDropDownAction_CB);[m + IupSetCallback(ih->data->droph, "KILLFOCUS_CB", (Icallback)iMatrixEditKillFocus_CB);[m + IupSetCallback(ih->data->droph, "K_ANY", (Icallback)iMatrixEditDropDownKeyAny_CB);[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_focus.c b/iup/srccontrols/matrix/iupmat_focus.c[m +[1mindex 3c000f8..0cf680d 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_focus.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_focus.c[m +[36m@@ -35,13 +35,11 @@[m [mint iupMatrixFocus_CB(Ihandle* ih, int focus)[m + if (!iupMatrixIsValid(ih, 1))[m + return IUP_DEFAULT;[m + [m +[31m- if (iupStrEqualNoCase(IupGetGlobal("DRIVER"), "Motif"))[m +[32m+[m[32m if (IupGetGlobal("MOTIFVERSION"))[m + {[m +[31m- if (focus && iupAttribGet(ih, "_IUPMAT_DOUBLE_CLICK"))[m +[31m- {[m +[31m- iupAttribSetStr(ih, "_IUPMAT_DOUBLE_CLICK", NULL);[m +[32m+[m[32m if (iupAttribGet(ih, "_IUPMAT_DROPDOWN") || /* from iMatrixEditDropDown_CB, in Motif */[m +[32m+[m[32m iupAttribGet(ih, "_IUPMAT_DOUBLECLICK")) /* from iMatrixMouseLeftPress, in Motif */[m + return IUP_DEFAULT;[m +[31m- }[m + }[m + [m + ih->data->has_focus = focus;[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_getset.c b/iup/srccontrols/matrix/iupmat_getset.c[m +[1mindex 34947b6..4424948 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_getset.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_getset.c[m +[36m@@ -313,7 +313,7 @@[m [mchar* iupMatrixGetFont(Ihandle* ih, int lin, int col)[m + return font;[m + }[m + [m +[31m-char *iupMatrixGetSize(Ihandle* ih, int index, int m, int pixels)[m +[32m+[m[32mchar *iupMatrixGetSize(Ihandle* ih, int index, int m, int pixels_unit)[m + {[m + char* str;[m + int size;[m +[36m@@ -342,7 +342,7 @@[m [mchar *iupMatrixGetSize(Ihandle* ih, int index, int m, int pixels)[m + else[m + size -= IMAT_PADDING_H + IMAT_FRAME_H;[m + [m +[31m- if (!pixels)[m +[32m+[m[32m if (!pixels_unit)[m + {[m + int charwidth, charheight;[m + iupdrvFontGetCharSize(ih, &charwidth, &charheight);[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_getset.h b/iup/srccontrols/matrix/iupmat_getset.h[m +[1mindex 9ae3d07..f26e01e 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_getset.h[m +[1m+++ b/iup/srccontrols/matrix/iupmat_getset.h[m +[36m@@ -26,7 +26,7 @@[m [mvoid iupMatrixGetFgRGB(Ihandle* ih, int lin, int col, unsigned char *r, unsigned[m + [m + void iupMatrixCellUpdateValue(Ihandle* ih);[m + [m +[31m-char* iupMatrixGetSize(Ihandle* ih, int index, int m, int pixels);[m +[32m+[m[32mchar* iupMatrixGetSize(Ihandle* ih, int index, int m, int pixels_unit);[m + [m + int iupMatrixCheckCellPos(Ihandle* ih, int lin, int col);[m + [m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_key.c b/iup/srccontrols/matrix/iupmat_key.c[m +[1mindex ae9ed55..4824438 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_key.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_key.c[m +[36m@@ -37,7 +37,7 @@[m [mint iupMatrixProcessKeyPress(Ihandle* ih, int c)[m + int ret = IUP_IGNORE; /* default for processed keys */[m + [m + /* If the focus is not visible, a scroll is done for that the focus to be visible */[m +[31m- if (!iupMatrixAuxIsCellFullVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell))[m +[32m+[m[32m if (!iupMatrixAuxIsCellStartVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell))[m + iupMatrixScrollToVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell);[m + [m + switch (c)[m +[36m@@ -47,7 +47,7 @@[m [mint iupMatrixProcessKeyPress(Ihandle* ih, int c)[m + case K_HOME:[m + if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)[m + break;[m +[31m- iupMatrixScrollKeyHome(ih);[m +[32m+[m[32m iupMATRIX_ScrollKeyHome(ih);[m + ih->data->homekeycount++;[m + iupMatrixAuxCallEnterCellCb(ih);[m + break;[m +[36m@@ -57,7 +57,7 @@[m [mint iupMatrixProcessKeyPress(Ihandle* ih, int c)[m + case K_END:[m + if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)[m + break;[m +[31m- iupMatrixScrollKeyEnd(ih);[m +[32m+[m[32m iupMATRIX_ScrollKeyEnd(ih);[m + ih->data->endkeycount++;[m + iupMatrixAuxCallEnterCellCb(ih);[m + break;[m +[36m@@ -71,7 +71,7 @@[m [mint iupMatrixProcessKeyPress(Ihandle* ih, int c)[m + case K_LEFT:[m + if (iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)[m + break;[m +[31m- iupMatrixScrollKeyLeft(ih);[m +[32m+[m[32m iupMATRIX_ScrollKeyLeft(ih);[m + iupMatrixAuxCallEnterCellCb(ih);[m + break;[m + [m +[36m@@ -80,7 +80,7 @@[m [mint iupMatrixProcessKeyPress(Ihandle* ih, int c)[m + case K_RIGHT:[m + if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)[m + break;[m +[31m- iupMatrixScrollKeyRight(ih);[m +[32m+[m[32m iupMATRIX_ScrollKeyRight(ih);[m + iupMatrixAuxCallEnterCellCb(ih);[m + break;[m + [m +[36m@@ -89,7 +89,7 @@[m [mint iupMatrixProcessKeyPress(Ihandle* ih, int c)[m + case K_UP:[m + if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)[m + break;[m +[31m- iupMatrixScrollKeyUp(ih);[m +[32m+[m[32m iupMATRIX_ScrollKeyUp(ih);[m + iupMatrixAuxCallEnterCellCb(ih);[m + break ;[m + [m +[36m@@ -98,7 +98,7 @@[m [mint iupMatrixProcessKeyPress(Ihandle* ih, int c)[m + case K_DOWN:[m + if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)[m + break;[m +[31m- iupMatrixScrollKeyDown(ih);[m +[32m+[m[32m iupMATRIX_ScrollKeyDown(ih);[m + iupMatrixAuxCallEnterCellCb(ih);[m + break;[m + [m +[36m@@ -106,7 +106,7 @@[m [mint iupMatrixProcessKeyPress(Ihandle* ih, int c)[m + case K_PGUP:[m + if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)[m + break;[m +[31m- iupMatrixScrollKeyPgUp(ih);[m +[32m+[m[32m iupMATRIX_ScrollKeyPgUp(ih);[m + iupMatrixAuxCallEnterCellCb(ih);[m + break;[m + [m +[36m@@ -114,7 +114,7 @@[m [mint iupMatrixProcessKeyPress(Ihandle* ih, int c)[m + case K_PGDN:[m + if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)[m + break;[m +[31m- iupMatrixScrollKeyPgDown(ih);[m +[32m+[m[32m iupMATRIX_ScrollKeyPgDown(ih);[m + iupMatrixAuxCallEnterCellCb(ih);[m + break;[m + [m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_mouse.c b/iup/srccontrols/matrix/iupmat_mouse.c[m +[1mindex 33b5fe7..a3ffa82 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_mouse.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_mouse.c[m +[36m@@ -80,12 +80,18 @@[m [mstatic void iMatrixMouseLeftPress(Ihandle* ih, int lin, int col, int shift, int[m + [m + if (iupMatrixEditShow(ih))[m + {[m +[31m- if(ih->data->datah == ih->data->droph) [m +[32m+[m[32m if (ih->data->datah == ih->data->droph)[m + IupSetAttribute(ih->data->datah, "SHOWDROPDOWN", "YES");[m + [m +[31m- if (iupStrEqualNoCase(IupGetGlobal("DRIVER"), "Motif"))[m +[31m- if(atoi(IupGetGlobal("MOTIFNUMBER")) < 2203) /* since OpenMotif version 2.2.3 this is not necessary */[m +[31m- iupAttribSetStr(ih, "_IUPMAT_DOUBLE_CLICK", "1");[m +[32m+[m[32m if (IupGetGlobal("MOTIFVERSION"))[m +[32m+[m[32m {[m +[32m+[m[32m /* Sequece of focus_cb in Motif from here:[m +[32m+[m[32m Matrix-Focus(0) - ok[m +[32m+[m[32m Edit-KillFocus - weird, must avoid using _IUPMAT_DOUBLECLICK[m +[32m+[m[32m Since OpenMotif version 2.2.3 this is not necessary anymore. */[m +[32m+[m[32m if (atoi(IupGetGlobal("MOTIFNUMBER")) < 2203)[m[41m [m +[32m+[m[32m iupAttribSetStr(ih, "_IUPMAT_DOUBLECLICK", "1");[m +[32m+[m[32m }[m + }[m + }[m + else /* single click */[m +[36m@@ -182,14 +188,14 @@[m [mint iupMatrixMouseMove_CB(Ihandle* ih, int x, int y)[m + if (ih->data->leftpressed && ih->data->mark_multiple && ih->data->mark_mode != IMAT_MARK_NO)[m + {[m + if ((x < ih->data->columns.sizes[0] || x < IMAT_DRAG_SCROLL_DELTA) && (ih->data->columns.first > 1))[m +[31m- iupMatrixScrollLeft(ih);[m +[32m+[m[32m iupMATRIX_ScrollLeft(ih);[m + else if ((x > ih->data->w - IMAT_DRAG_SCROLL_DELTA) && (ih->data->columns.last < ih->data->columns.num-1))[m +[31m- iupMatrixScrollRight(ih);[m +[32m+[m[32m iupMATRIX_ScrollRight(ih);[m + [m + if ((y < ih->data->lines.sizes[0] || y < IMAT_DRAG_SCROLL_DELTA) && (ih->data->lines.first > 1))[m +[31m- iupMatrixScrollUp(ih);[m +[32m+[m[32m iupMATRIX_ScrollUp(ih);[m + else if ((y > ih->data->h - IMAT_DRAG_SCROLL_DELTA) && (ih->data->lines.last < ih->data->lines.num-1))[m +[31m- iupMatrixScrollDown(ih);[m +[32m+[m[32m iupMATRIX_ScrollDown(ih);[m + [m + if (iupMatrixAuxGetLinColFromXY(ih, x, y, &lin, &col))[m + {[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_numlc.c b/iup/srccontrols/matrix/iupmat_numlc.c[m +[1mindex e48720a..6e628b7 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_numlc.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_numlc.c[m +[36m@@ -294,7 +294,7 @@[m [mint iupMatrixSetAddLinAttrib(Ihandle* ih, const char* value)[m + {[m + int base, count, lines_num = ih->data->lines.num;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + [m + if (!iMatrixGetStartEnd(value, &base, &count, lines_num, 0))[m +[36m@@ -326,7 +326,7 @@[m [mint iupMatrixSetDelLinAttrib(Ihandle* ih, const char* value)[m + {[m + int base, count, lines_num = ih->data->lines.num;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + [m + if (!iMatrixGetStartEnd(value, &base, &count, lines_num, 1))[m +[36m@@ -366,7 +366,7 @@[m [mint iupMatrixSetAddColAttrib(Ihandle* ih, const char* value)[m + {[m + int base, count, columns_num = ih->data->columns.num;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + [m + if (!iMatrixGetStartEnd(value, &base, &count, columns_num, 0))[m +[36m@@ -398,7 +398,7 @@[m [mint iupMatrixSetDelColAttrib(Ihandle* ih, const char* value)[m + {[m + int base, count, columns_num = ih->data->columns.num;[m + [m +[31m- if (!ih->handle) /* do not store the action before map */[m +[32m+[m[32m if (!ih->handle) /* do not do the action before map */[m + return 0;[m + [m + if (!iMatrixGetStartEnd(value, &base, &count, columns_num, 1))[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_scroll.c b/iup/srccontrols/matrix/iupmat_scroll.c[m +[1mindex 24bbef2..845d248 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_scroll.c[m +[1m+++ b/iup/srccontrols/matrix/iupmat_scroll.c[m +[36m@@ -32,54 +32,32 @@[m + /* Private functions */[m + /**************************************************************************/[m + [m +[31m-[m +[31m-static int iMatrixScrollIsFullVisibleLast(ImatLinColData *p)[m +[31m-{[m +[31m- int i, sum = 0;[m +[31m-[m +[31m- for(i = p->first; i <= p->last; i++)[m +[31m- sum += p->sizes[i];[m +[31m-[m +[31m- if (sum > p->visible_size)[m +[31m- return 0;[m +[31m- else[m +[31m- return 1;[m +[31m-}[m +[31m-[m +[31m-/* Scroll columns/lines in the left/top side of the matriz until the last column/line is FULLY visible.[m +[31m- -> m : Define the mode of operation: lines or columns [IMAT_PROCESS_LIN|IMAT_PROCESS_COL] */[m +[31m-static void iMatrixScrollToVisible(Ihandle* ih, int m, int index)[m +[32m+[m[32mstatic void iMatrixScrollToVisible(ImatLinColData* p, int index)[m + {[m +[31m- ImatLinColData* p;[m +[32m+[m[32m /* The work here is just to position first and first_offset,[m[41m [m +[32m+[m[32m so "index" is between "first" and "last". */[m +[32m+[m[41m [m +[32m+[m[32m /* It is called only for discrete scrolling,[m[41m [m +[32m+[m[32m so first_offset usually will be set to 0. */[m +[32m+[m +[32m+[m[32m /* already visible, change nothing */[m +[32m+[m[32m if (index > p->first && index < p->last)[m +[32m+[m[32m return;[m + [m +[31m- if (m == IMAT_PROCESS_LIN)[m +[31m- p = &(ih->data->lines);[m +[31m- else[m +[31m- p = &(ih->data->columns);[m +[32m+[m[32m /* scroll to visible, means position the cell so the start at left is visible */[m + [m +[31m- if (index < p->first)[m +[32m+[m[32m if (index <= p->first)[m + {[m + p->first = index;[m +[32m+[m[32m p->first_offset = 0;[m + return;[m + }[m +[31m- else if (index > p->last)[m +[32m+[m[32m else /* (index >= p->last) */[m + {[m +[31m- /* Increment the first column/line until the index is visible */[m +[31m- while(index > p->last && p->last != (p->num - 1))[m +[31m- {[m +[31m- p->first++;[m +[31m- iupMatrixAuxUpdateLast(p);[m +[31m- } [m +[31m- }[m +[32m+[m[32m p->last = index;[m + [m +[31m- if (index == p->last)[m +[31m- {[m +[31m- /* must increment util the last is fully visible */[m +[31m- while(index == p->last && p->last != (p->num - 1) && !iMatrixScrollIsFullVisibleLast(p))[m +[31m- {[m +[31m- p->first++;[m +[31m- iupMatrixAuxUpdateLast(p);[m +[31m- } [m +[32m+[m[32m /* adjust "first" according to "last" */[m +[32m+[m[32m iupMatrixAuxAdjustFirstFromLast(p);[m + }[m + }[m + [m +[36m@@ -133,119 +111,114 @@[m [mstatic int iMatrixScrollGetPrevNonEmpty(Ihandle* ih, int m, int index)[m + return index;[m + }[m + [m +[31m-static void iMatrixScrollSetFocusScrollToVisible(Ihandle* ih, int m, int index)[m +[32m+[m[32mstatic void iMatrixScrollSetFocusScrollToVisible(Ihandle* ih, int lin, int col)[m +[32m+[m[32m{[m +[32m+[m[32m /* moving focus and eventually scrolling */[m +[32m+[m[32m iupMatrixFocusSet(ih, lin, col);[m +[32m+[m +[32m+[m[32m /* set for both because focus maybe hidden */[m +[32m+[m[32m iMatrixScrollToVisible(&ih->data->columns, ih->data->columns.focus_cell);[m +[32m+[m[32m iMatrixScrollToVisible(&ih->data->lines, ih->data->lines.focus_cell);[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic void iMatrixScrollSetFocusScrollToVisibleLinCol(Ihandle* ih, int m, int index)[m + {[m + if (m == IMAT_PROCESS_COL)[m +[31m- iupMatrixFocusSet(ih, ih->data->lines.focus_cell, index);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisible(ih, ih->data->lines.focus_cell, index);[m + else[m +[31m- iupMatrixFocusSet(ih, index, ih->data->columns.focus_cell);[m +[31m-[m +[31m- /* set for both because current focus maybe hidden */[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_COL, ih->data->columns.focus_cell);[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_LIN, ih->data->lines.focus_cell);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisible(ih, index, ih->data->columns.focus_cell);[m + }[m + [m +[32m+[m + /**************************************************************************/[m + /* Exported functions */[m + /**************************************************************************/[m + [m + [m +[31m-/* Move using the cells of matrix.[m +[31m- Receive as a parameter a pointer to a function that will make the work,[m +[31m- in fact. This is done to avoid a test to each of the manipulation cursor[m +[31m- functions, verifying if it is necessary to call or not the scroll[m +[31m- callback. This is only done here.[m +[31m- -> func - pointer to the function that will make the movement[m +[31m- -> mode - parameter passed to func, specify if the movement request is of[m +[31m- the scrollbar or the keyboard[m +[31m- -> pos - parameter passed to func, that will be the handle position function[m +[31m- of the scrollbar, returning the scrollbar thumb position...[m +[31m- if func is other function, this parameter will be ignored[m +[31m- -> m - parameter passed to func, specify which is the mode of operation:[m +[31m- lines or columns [IMAT_PROCESS_LIN|IMAT_PROCESS_COL][m +[31m-*/[m +[31m-void iupMatrixScrollMoveCursor(iupMatrixScrollMoveF func, Ihandle* ih, int mode, float pos, int m)[m +[32m+[m[32mvoid iupMatrixScrollToVisible(Ihandle* ih, int lin, int col)[m + {[m + int old_lines_first = ih->data->lines.first;[m + int old_columns_first = ih->data->columns.first;[m +[32m+[m[32m int old_lines_first_offset = ih->data->lines.first_offset;[m +[32m+[m[32m int old_columns_first_offset = ih->data->columns.first_offset;[m + [m +[31m- iupMatrixEditForceHidden(ih);[m +[32m+[m[32m iMatrixScrollToVisible(&ih->data->columns, col);[m +[32m+[m[32m iMatrixScrollToVisible(&ih->data->lines, lin);[m + [m +[31m- func(ih, mode, pos, m);[m +[31m-[m +[31m- if (ih->data->lines.first != old_lines_first || ih->data->columns.first != old_columns_first)[m +[32m+[m[32m if ((ih->data->lines.first != old_lines_first || ih->data->lines.first_offset != old_lines_first_offset) ||[m +[32m+[m[32m (ih->data->columns.first != old_columns_first || ih->data->columns.first_offset != old_columns_first_offset))[m + {[m +[31m- if (ih->data->columns.first != old_columns_first)[m +[31m- iupMatrixAuxUpdateVisiblePos(ih, IMAT_PROCESS_COL);[m +[32m+[m[32m /* when "first" is changed must update scroll pos */[m +[32m+[m[32m if (ih->data->columns.first != old_columns_first || ih->data->columns.first_offset != old_columns_first_offset)[m +[32m+[m[32m iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_COL);[m + [m +[31m- if (ih->data->lines.first != old_lines_first)[m +[31m- iupMatrixAuxUpdateVisiblePos(ih, IMAT_PROCESS_LIN);[m +[32m+[m[32m if (ih->data->lines.first != old_lines_first || ih->data->lines.first_offset != old_lines_first_offset)[m +[32m+[m[32m iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_LIN);[m + [m + iMatrixScrollCallScrollTopCb(ih);[m + [m +[31m- iupMatrixDraw(ih, 0);[m +[32m+[m[32m iupMatrixDraw(ih, 1);[m + }[m + }[m + [m +[31m-void iupMatrixScrollToVisible(Ihandle* ih, int lin, int col)[m +[32m+[m[32mvoid iupMatrixScrollMove(iupMatrixScrollMoveFunc func, Ihandle* ih, int mode, float pos, int m)[m + {[m + int old_lines_first = ih->data->lines.first;[m + int old_columns_first = ih->data->columns.first;[m +[32m+[m[32m int old_lines_first_offset = ih->data->lines.first_offset;[m +[32m+[m[32m int old_columns_first_offset = ih->data->columns.first_offset;[m + [m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_COL, col);[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_LIN, lin);[m +[32m+[m[32m iupMatrixEditForceHidden(ih);[m + [m +[31m- if (ih->data->lines.first != old_lines_first || ih->data->columns.first != old_columns_first)[m +[32m+[m[32m func(ih, mode, pos, m);[m +[32m+[m +[32m+[m[32m if ((ih->data->lines.first != old_lines_first || ih->data->lines.first_offset != old_lines_first_offset) ||[m +[32m+[m[32m (ih->data->columns.first != old_columns_first || ih->data->columns.first_offset != old_columns_first_offset))[m + {[m +[31m- if (ih->data->columns.first != old_columns_first)[m +[31m- iupMatrixAuxUpdateVisiblePos(ih, IMAT_PROCESS_COL);[m +[32m+[m[32m /* when "first" is changed must update scroll pos */[m +[32m+[m[32m if (ih->data->columns.first != old_columns_first || ih->data->columns.first_offset != old_columns_first_offset)[m +[32m+[m[32m iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_COL);[m + [m +[31m- if (ih->data->lines.first != old_lines_first)[m +[31m- iupMatrixAuxUpdateVisiblePos(ih, IMAT_PROCESS_LIN);[m +[32m+[m[32m if (ih->data->lines.first != old_lines_first || ih->data->lines.first_offset != old_lines_first_offset)[m +[32m+[m[32m iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_LIN);[m + [m + iMatrixScrollCallScrollTopCb(ih);[m + [m +[31m- iupMatrixDraw(ih, 1);[m +[32m+[m[32m iupMatrixDraw(ih, 0);[m + }[m + }[m + [m +[32m+[m[32m/************************************************************************************/[m +[32m+[m + /* This function is called when the "home" key is pressed.[m + In the first time, go to the beginning of the line.[m + In the second time, go to the beginning of the page.[m + In the third time, go to the beginning of the matrix.[m + -> mode and pos : DO NOT USED.[m + */[m +[31m-void iupMatrixScrollHome(Ihandle* ih, int unused_mode, float unused_pos, int unused_m)[m +[32m+[m[32mvoid iupMatrixScrollHomeFunc(Ihandle* ih, int unused_mode, float unused_pos, int unused_m)[m + {[m + (void)unused_m;[m + (void)unused_mode;[m + (void)unused_pos;[m + [m + /* called only for mode==IMAT_SCROLLKEY */[m +[32m+[m[32m /* moving focus and eventually scrolling */[m + [m + if(ih->data->homekeycount == 0) /* go to the beginning of the line */[m + {[m +[31m- ih->data->columns.first = iMatrixScrollGetNextNonEmpty(ih, IMAT_PROCESS_COL, 1);[m +[31m- iMatrixScrollSetFocusScrollToVisible(ih, IMAT_PROCESS_COL, ih->data->columns.first);[m +[32m+[m[32m int col = iMatrixScrollGetNextNonEmpty(ih, IMAT_PROCESS_COL, 1);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisibleLinCol(ih, IMAT_PROCESS_COL, col);[m + }[m + else if(ih->data->homekeycount == 1) /* go to the beginning of the visible page */[m + {[m +[31m- iupMatrixFocusSet(ih, ih->data->lines.first, ih->data->columns.first);[m +[31m-[m +[31m- /* set for both because current focus maybe hidden */[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_COL, ih->data->columns.focus_cell);[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_LIN, ih->data->lines.focus_cell);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisible(ih, ih->data->lines.first, ih->data->columns.first);[m + }[m + else if(ih->data->homekeycount == 2) /* go to the beginning of the matrix 1:1 */[m + {[m +[31m- ih->data->columns.first = iMatrixScrollGetNextNonEmpty(ih, IMAT_PROCESS_COL, 1);[m +[31m- ih->data->lines.first = iMatrixScrollGetNextNonEmpty(ih, IMAT_PROCESS_LIN, 1);[m +[31m-[m +[31m- iupMatrixFocusSet(ih, ih->data->lines.first, ih->data->columns.first);[m +[31m-[m +[31m- /* set for both because current focus maybe hidden */[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_COL, ih->data->columns.focus_cell);[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_LIN, ih->data->lines.focus_cell);[m +[32m+[m[32m int lin = iMatrixScrollGetNextNonEmpty(ih, IMAT_PROCESS_LIN, 1);[m +[32m+[m[32m int col = iMatrixScrollGetNextNonEmpty(ih, IMAT_PROCESS_COL, 1);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisible(ih, lin, col);[m + }[m + }[m + [m +[36m@@ -255,37 +228,29 @@[m [mvoid iupMatrixScrollHome(Ihandle* ih, int unused_mode, float unused_pos, int unu[m + In the third time, go to the end of the matrix.[m + -> mode and pos : DO NOT USED.[m + */[m +[31m-void iupMatrixScrollEnd(Ihandle* ih, int unused_mode, float unused_pos, int unused_m)[m +[32m+[m[32mvoid iupMatrixScrollEndFunc(Ihandle* ih, int unused_mode, float unused_pos, int unused_m)[m + {[m + (void)unused_m;[m + (void)unused_mode;[m + (void)unused_pos;[m + [m + /* called only for mode==IMAT_SCROLLKEY */[m +[32m+[m[32m /* moving focus and eventually scrolling */[m + [m + if(ih->data->endkeycount == 0) /* go to the end of the line */[m + {[m +[31m- int last_col = iMatrixScrollGetPrevNonEmpty(ih, IMAT_PROCESS_COL, ih->data->columns.num-1);[m +[31m- iMatrixScrollSetFocusScrollToVisible(ih, IMAT_PROCESS_COL, last_col);[m +[32m+[m[32m int col = iMatrixScrollGetPrevNonEmpty(ih, IMAT_PROCESS_COL, ih->data->columns.num-1);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisibleLinCol(ih, IMAT_PROCESS_COL, col);[m + }[m + else if(ih->data->endkeycount == 1) /* go to the end of the visible page */[m + {[m +[31m- iupMatrixFocusSet(ih, ih->data->lines.last, ih->data->columns.last);[m +[31m-[m +[31m- /* set for both because current focus maybe hidden */[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_COL, ih->data->columns.focus_cell);[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_LIN, ih->data->lines.focus_cell);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisible(ih, ih->data->lines.last, ih->data->columns.last);[m + }[m + else if(ih->data->endkeycount == 2) /* go to the end of the matrix */[m + {[m +[31m- int last_col = iMatrixScrollGetPrevNonEmpty(ih, IMAT_PROCESS_COL, ih->data->columns.num-1);[m +[31m- int last_lin = iMatrixScrollGetPrevNonEmpty(ih, IMAT_PROCESS_LIN, ih->data->lines.num-1);[m +[31m-[m +[31m- iupMatrixFocusSet(ih, last_lin, last_col);[m +[31m-[m +[31m- /* set for both because current focus maybe hidden */[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_COL, ih->data->columns.focus_cell);[m +[31m- iMatrixScrollToVisible(ih, IMAT_PROCESS_LIN, ih->data->lines.focus_cell);[m +[32m+[m[32m int lin = iMatrixScrollGetPrevNonEmpty(ih, IMAT_PROCESS_LIN, ih->data->lines.num-1);[m +[32m+[m[32m int col = iMatrixScrollGetPrevNonEmpty(ih, IMAT_PROCESS_COL, ih->data->columns.num-1);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisible(ih, lin, col);[m + }[m + }[m + [m +[36m@@ -295,7 +260,7 @@[m [mvoid iupMatrixScrollEnd(Ihandle* ih, int unused_mode, float unused_pos, int unus[m + -> pos : DO NOT USED[m + -> m : define the mode of operation: lines or columns [IMAT_PROCESS_LIN|IMAT_PROCESS_COL][m + */[m +[31m-void iupMatrixScrollLeftUp(Ihandle* ih, int mode, float pos, int m)[m +[32m+[m[32mvoid iupMatrixScrollLeftUpFunc(Ihandle* ih, int mode, float pos, int m)[m + {[m + ImatLinColData* p;[m + (void)pos;[m +[36m@@ -307,12 +272,15 @@[m [mvoid iupMatrixScrollLeftUp(Ihandle* ih, int mode, float pos, int m)[m + [m + if (mode == IMAT_SCROLLKEY)[m + {[m +[32m+[m[32m /* moving focus and eventually scrolling */[m + int next = iMatrixScrollGetPrevNonEmpty(ih, m, p->focus_cell-1);[m +[31m- iMatrixScrollSetFocusScrollToVisible(ih, m, next);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisibleLinCol(ih, m, next);[m + }[m + else /* IMAT_SCROLLBAR */[m + {[m +[32m+[m[32m /* always scrolling without changing focus */[m + p->first = iMatrixScrollGetPrevNonEmpty(ih, m, p->first-1);[m +[32m+[m[32m p->first_offset = 0;[m + }[m + }[m + [m +[36m@@ -322,7 +290,7 @@[m [mvoid iupMatrixScrollLeftUp(Ihandle* ih, int mode, float pos, int m)[m + -> pos : DO NOT USED[m + -> m : define the mode of operation: lines or columns [IMAT_PROCESS_LIN|IMAT_PROCESS_COL][m + */[m +[31m-void iupMatrixScrollRightDown(Ihandle* ih, int mode, float pos, int m)[m +[32m+[m[32mvoid iupMatrixScrollRightDownFunc(Ihandle* ih, int mode, float pos, int m)[m + {[m + ImatLinColData* p;[m + (void)pos;[m +[36m@@ -334,12 +302,15 @@[m [mvoid iupMatrixScrollRightDown(Ihandle* ih, int mode, float pos, int m)[m + [m + if (mode == IMAT_SCROLLKEY)[m + {[m +[32m+[m[32m /* moving focus and eventually scrolling */[m + int next = iMatrixScrollGetNextNonEmpty(ih, m, p->focus_cell+1);[m +[31m- iMatrixScrollSetFocusScrollToVisible(ih, m, next);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisibleLinCol(ih, m, next);[m + }[m + else /* IMAT_SCROLLBAR */[m + {[m +[32m+[m[32m /* always scrolling without changing focus */[m + p->first = iMatrixScrollGetNextNonEmpty(ih, m, p->first+1);[m +[32m+[m[32m p->first_offset = 0;[m + }[m + }[m + [m +[36m@@ -349,7 +320,7 @@[m [mvoid iupMatrixScrollRightDown(Ihandle* ih, int mode, float pos, int m)[m + -> pos : DO NOT USED[m + -> m : define the mode of operation: lines (PgLeft) or columns (PgUp) [IMAT_PROCESS_LIN|IMAT_PROCESS_COL][m + */[m +[31m-void iupMatrixScrollPgLeftUp(Ihandle* ih, int mode, float pos, int m)[m +[32m+[m[32mvoid iupMatrixScrollPgLeftUpFunc(Ihandle* ih, int mode, float pos, int m)[m + {[m + ImatLinColData* p;[m + (void)pos;[m +[36m@@ -361,12 +332,15 @@[m [mvoid iupMatrixScrollPgLeftUp(Ihandle* ih, int mode, float pos, int m)[m + [m + if (mode == IMAT_SCROLLKEY)[m + {[m +[32m+[m[32m /* moving focus and eventually scrolling */[m + int next = iMatrixScrollGetPrevNonEmpty(ih, m, p->focus_cell - (p->last - p->first));[m +[31m- iMatrixScrollSetFocusScrollToVisible(ih, m, next);[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisibleLinCol(ih, m, next);[m + }[m + else /* IMAT_SCROLLBAR */[m + {[m +[32m+[m[32m /* always scrolling without changing focus */[m + p->first = iMatrixScrollGetPrevNonEmpty(ih, m, p->first - (p->last - p->first));[m +[32m+[m[32m p->first_offset = 0;[m + }[m + }[m + [m +[36m@@ -376,7 +350,7 @@[m [mvoid iupMatrixScrollPgLeftUp(Ihandle* ih, int mode, float pos, int m)[m + -> pos : DO NOT USED[m + -> m : define the mode of operation: lines (PgDown) or columns (PgRight) [IMAT_PROCESS_LIN|IMAT_PROCESS_COL][m + */[m +[31m-void iupMatrixScrollPgRightDown(Ihandle* ih, int mode, float pos, int m)[m +[32m+[m[32mvoid iupMatrixScrollPgRightDownFunc(Ihandle* ih, int mode, float pos, int m)[m + {[m + ImatLinColData* p;[m + (void)pos;[m +[36m@@ -388,16 +362,19 @@[m [mvoid iupMatrixScrollPgRightDown(Ihandle* ih, int mode, float pos, int m)[m + [m + if (mode == IMAT_SCROLLKEY)[m + {[m +[31m- int next = iMatrixScrollGetNextNonEmpty(ih, IMAT_PROCESS_COL, p->focus_cell + (p->last - p->first));[m +[31m- iMatrixScrollSetFocusScrollToVisible(ih, m, next);[m +[32m+[m[32m /* moving focus and eventually scrolling */[m +[32m+[m[32m int next = iMatrixScrollGetNextNonEmpty(ih, m, p->focus_cell + (p->last - p->first));[m +[32m+[m[32m iMatrixScrollSetFocusScrollToVisibleLinCol(ih, m, next);[m + }[m + else /* IMAT_SCROLLBAR */[m + {[m +[32m+[m[32m /* always scrolling without changing focus */[m + p->first = iMatrixScrollGetPrevNonEmpty(ih, m, p->first + (p->last - p->first));[m +[32m+[m[32m p->first_offset = 0;[m + }[m + }[m + [m +[31m-void iupMatrixScrollCr(Ihandle* ih, int unused_mode, float unused_pos, int unused_m)[m +[32m+[m[32mvoid iupMatrixScrollCrFunc(Ihandle* ih, int unused_mode, float unused_pos, int unused_m)[m + {[m + int oldlin = ih->data->lines.focus_cell;[m + int oldcol = ih->data->columns.focus_cell;[m +[36m@@ -408,13 +385,13 @@[m [mvoid iupMatrixScrollCr(Ihandle* ih, int unused_mode, float unused_pos, int unuse[m + /* called only for mode==IMAT_SCROLLKEY */[m + [m + /* try the normal processing of next cell down */[m +[31m- iupMatrixScrollRightDown(ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN);[m +[32m+[m[32m iupMatrixScrollRightDownFunc(ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN);[m + [m + if(ih->data->lines.focus_cell == oldlin && ih->data->columns.focus_cell == oldcol)[m + {[m + /* If focus was not changed, it was because it is in the last line of the column.[m + Go to the next column of the same line. */[m +[31m- iupMatrixScrollRightDown(ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_COL);[m +[32m+[m[32m iupMatrixScrollRightDownFunc(ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_COL);[m + }[m + }[m + [m +[36m@@ -423,70 +400,51 @@[m [mvoid iupMatrixScrollCr(Ihandle* ih, int unused_mode, float unused_pos, int unuse[m + -> mode : DO NOT USED[m + -> m : define the mode of operation: lines or columns [IMAT_PROCESS_LIN|IMAT_PROCESS_COL][m + */[m +[31m-void iupMatrixScrollPos(Ihandle* ih, int mode, float pos, int m)[m +[32m+[m[32mvoid iupMatrixScrollPosFunc(Ihandle* ih, int mode, float pos, int m)[m + {[m +[31m- int scroll_pos, index, vp;[m +[31m- float d;[m +[32m+[m[32m int scroll_pos;[m + ImatLinColData* p;[m + (void)mode;[m + [m + if (m == IMAT_PROCESS_LIN)[m +[31m- {[m + p = &(ih->data->lines);[m +[31m- d = IupGetFloat(ih, "DY");[m +[31m- }[m + else[m +[31m- {[m + p = &(ih->data->columns);[m +[31m- d = IupGetFloat(ih, "DX");[m +[31m- }[m + [m + if (p->num == 1)[m + {[m + p->first = 1;[m +[32m+[m[32m p->first_offset = 0;[m + return;[m + }[m + [m + scroll_pos = (int)(pos * p->total_size + 0.5);[m + [m +[31m- vp = 0;[m +[31m- for(index = 1; index < p->num; index++)[m +[31m- {[m +[31m- vp += p->sizes[index];[m +[31m- if (vp > scroll_pos)[m +[31m- break;[m +[31m- }[m +[31m-[m +[31m- if (index == p->num)[m +[31m- {[m +[31m- if (p->num == 1)[m +[31m- index = 1;[m +[31m- else[m +[31m- index = p->num-1;[m +[31m- }[m +[31m-[m +[31m- p->first = index;[m +[32m+[m[32m /* position first and first_offset, according to scroll pos */[m +[32m+[m[32m iupMatrixAuxAdjustFirstFromScrollPos(p, scroll_pos);[m + }[m + [m +[31m-int iupMatrixScroll_CB(Ihandle* ih, int action, float x, float y)[m +[32m+[m[32m/************************************************************************************/[m +[32m+[m +[32m+[m[32mint iupMatrixScroll_CB(Ihandle* ih, int action, float posx, float posy)[m + {[m + if (!iupMatrixIsValid(ih, 0))[m + return IUP_DEFAULT;[m + [m + switch(action)[m + {[m +[31m- case IUP_SBUP : iupMatrixScrollUp(ih); break;[m +[31m- case IUP_SBDN : iupMatrixScrollDown(ih); break;[m +[31m- case IUP_SBPGUP : iupMatrixScrollPgUp(ih); break;[m +[31m- case IUP_SBPGDN : iupMatrixScrollPgDown(ih); break;[m +[31m- case IUP_SBRIGHT : iupMatrixScrollRight(ih); break;[m +[31m- case IUP_SBLEFT : iupMatrixScrollLeft(ih); break;[m +[31m- case IUP_SBPGRIGHT : iupMatrixScrollPgRight(ih); break;[m +[31m- case IUP_SBPGLEFT : iupMatrixScrollPgLeft(ih); break;[m +[31m- case IUP_SBPOSV : iupMatrixScrollPosVer(ih,y); break;[m +[31m- case IUP_SBPOSH : iupMatrixScrollPosHor(ih,x); break;[m +[31m- case IUP_SBDRAGV : iupMatrixScrollPosVer(ih,y); break;[m +[31m- case IUP_SBDRAGH : iupMatrixScrollPosHor(ih,x); break;[m +[32m+[m[32m case IUP_SBUP : iupMATRIX_ScrollUp(ih); break;[m +[32m+[m[32m case IUP_SBDN : iupMATRIX_ScrollDown(ih); break;[m +[32m+[m[32m case IUP_SBPGUP : iupMATRIX_ScrollPgUp(ih); break;[m +[32m+[m[32m case IUP_SBPGDN : iupMATRIX_ScrollPgDown(ih); break;[m +[32m+[m[32m case IUP_SBRIGHT : iupMATRIX_ScrollRight(ih); break;[m +[32m+[m[32m case IUP_SBLEFT : iupMATRIX_ScrollLeft(ih); break;[m +[32m+[m[32m case IUP_SBPGRIGHT : iupMATRIX_ScrollPgRight(ih); break;[m +[32m+[m[32m case IUP_SBPGLEFT : iupMATRIX_ScrollPgLeft(ih); break;[m +[32m+[m[32m case IUP_SBPOSV : iupMATRIX_ScrollPosVer(ih,posy); break;[m +[32m+[m[32m case IUP_SBPOSH : iupMATRIX_ScrollPosHor(ih,posx); break;[m +[32m+[m[32m case IUP_SBDRAGV : iupMATRIX_ScrollPosVer(ih,posy); break;[m +[32m+[m[32m case IUP_SBDRAGH : iupMATRIX_ScrollPosHor(ih,posx); break;[m + }[m + [m + iupMatrixDrawUpdate(ih);[m +[1mdiff --git a/iup/srccontrols/matrix/iupmat_scroll.h b/iup/srccontrols/matrix/iupmat_scroll.h[m +[1mindex 582442b..45d7417 100755[m +[1m--- a/iup/srccontrols/matrix/iupmat_scroll.h[m +[1m+++ b/iup/srccontrols/matrix/iupmat_scroll.h[m +[36m@@ -12,54 +12,54 @@[m + extern "C" {[m + #endif[m + [m +[31m-int iupMatrixScroll_CB(Ihandle* ih, int action, float x, float y);[m +[32m+[m[32mint iupMatrixScroll_CB(Ihandle* ih, int action, float posx, float posy);[m + [m + void iupMatrixScrollToVisible(Ihandle* ih, int lin, int col);[m + [m +[31m-typedef void (*iupMatrixScrollMoveF)(Ihandle* ih, int mode, float pos, int m);[m +[31m-void iupMatrixScrollMoveCursor(iupMatrixScrollMoveF func, Ihandle* ih, int mode, float pos, int m);[m +[32m+[m[32mtypedef void (*iupMatrixScrollMoveFunc)(Ihandle* ih, int mode, float pos, int m);[m +[32m+[m[32mvoid iupMatrixScrollMove(iupMatrixScrollMoveFunc func, Ihandle* ih, int mode, float pos, int m);[m + [m + /* Used only by the macros bellow */[m +[31m-void iupMatrixScrollHome (Ihandle* ih, int, float, int);[m +[31m-void iupMatrixScrollEnd (Ihandle* ih, int, float, int);[m +[31m-void iupMatrixScrollLeftUp (Ihandle* ih, int, float, int);[m +[31m-void iupMatrixScrollRightDown (Ihandle* ih, int, float, int);[m +[31m-void iupMatrixScrollPgLeftUp (Ihandle* ih, int, float, int);[m +[31m-void iupMatrixScrollPgRightDown(Ihandle* ih, int, float, int);[m +[31m-void iupMatrixScrollPos (Ihandle* ih, int, float, int);[m +[31m-void iupMatrixScrollCr (Ihandle* ih, int, float, int);[m +[32m+[m[32mvoid iupMatrixScrollHomeFunc (Ihandle* ih, int, float, int);[m +[32m+[m[32mvoid iupMatrixScrollEndFunc (Ihandle* ih, int, float, int);[m +[32m+[m[32mvoid iupMatrixScrollLeftUpFunc (Ihandle* ih, int, float, int);[m +[32m+[m[32mvoid iupMatrixScrollRightDownFunc (Ihandle* ih, int, float, int);[m +[32m+[m[32mvoid iupMatrixScrollPgLeftUpFunc (Ihandle* ih, int, float, int);[m +[32m+[m[32mvoid iupMatrixScrollPgRightDownFunc(Ihandle* ih, int, float, int);[m +[32m+[m[32mvoid iupMatrixScrollPosFunc (Ihandle* ih, int, float, int);[m +[32m+[m[32mvoid iupMatrixScrollCrFunc (Ihandle* ih, int, float, int);[m + [m + /* Mode used to "walk" inside the matrix.[m + It shows if the movement request was from the scrollbar or from a key.[m +[31m- Possible values for the "mode" parameter of the iupMatrixScrollMoveCursor function.[m +[32m+[m[32m Possible values for the "mode" parameter of the iupMatrixScrollMove function.[m + */[m + #define IMAT_SCROLLBAR 0[m + #define IMAT_SCROLLKEY 1[m + [m +[31m-/* Macros to help during the call of iupMatrixScrollMoveCursor function */[m +[32m+[m[32m/* Macros to help during the call of iupMatrixScrollMove function */[m + [m + /* used in the keyboard processing module */[m +[31m-#define iupMatrixScrollKeyHome(ih) iupMatrixScrollMoveCursor(iupMatrixScrollHome , ih, IMAT_SCROLLKEY, 0, 0)[m +[31m-#define iupMatrixScrollKeyEnd(ih) iupMatrixScrollMoveCursor(iupMatrixScrollEnd , ih, IMAT_SCROLLKEY, 0, 0)[m +[31m-#define iupMatrixScrollKeyPgUp(ih) iupMatrixScrollMoveCursor(iupMatrixScrollPgLeftUp , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN)[m +[31m-#define iupMatrixScrollKeyPgDown(ih) iupMatrixScrollMoveCursor(iupMatrixScrollPgRightDown, ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN)[m +[31m-#define iupMatrixScrollKeyDown(ih) iupMatrixScrollMoveCursor(iupMatrixScrollRightDown , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN)[m +[31m-#define iupMatrixScrollKeyRight(ih) iupMatrixScrollMoveCursor(iupMatrixScrollRightDown , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_COL)[m +[31m-#define iupMatrixScrollKeyUp(ih) iupMatrixScrollMoveCursor(iupMatrixScrollLeftUp , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN)[m +[31m-#define iupMatrixScrollKeyLeft(ih) iupMatrixScrollMoveCursor(iupMatrixScrollLeftUp , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_COL)[m +[31m-#define iupMatrixScrollKeyCr(ih) iupMatrixScrollMoveCursor(iupMatrixScrollCr , ih, IMAT_SCROLLKEY, 0, 0)[m +[32m+[m[32m#define iupMATRIX_ScrollKeyHome(ih) iupMatrixScrollMove(iupMatrixScrollHomeFunc , ih, IMAT_SCROLLKEY, 0, 0)[m +[32m+[m[32m#define iupMATRIX_ScrollKeyEnd(ih) iupMatrixScrollMove(iupMatrixScrollEndFunc , ih, IMAT_SCROLLKEY, 0, 0)[m +[32m+[m[32m#define iupMATRIX_ScrollKeyPgUp(ih) iupMatrixScrollMove(iupMatrixScrollPgLeftUpFunc , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN)[m +[32m+[m[32m#define iupMATRIX_ScrollKeyPgDown(ih) iupMatrixScrollMove(iupMatrixScrollPgRightDownFunc, ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN)[m +[32m+[m[32m#define iupMATRIX_ScrollKeyDown(ih) iupMatrixScrollMove(iupMatrixScrollRightDownFunc , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN)[m +[32m+[m[32m#define iupMATRIX_ScrollKeyRight(ih) iupMatrixScrollMove(iupMatrixScrollRightDownFunc , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_COL)[m +[32m+[m[32m#define iupMATRIX_ScrollKeyUp(ih) iupMatrixScrollMove(iupMatrixScrollLeftUpFunc , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_LIN)[m +[32m+[m[32m#define iupMATRIX_ScrollKeyLeft(ih) iupMatrixScrollMove(iupMatrixScrollLeftUpFunc , ih, IMAT_SCROLLKEY, 0, IMAT_PROCESS_COL)[m +[32m+[m[32m#define iupMATRIX_ScrollKeyCr(ih) iupMatrixScrollMove(iupMatrixScrollCrFunc , ih, IMAT_SCROLLKEY, 0, 0)[m + [m + /* Used by the scrollbar callback only */[m +[31m-#define iupMatrixScrollUp(ih) iupMatrixScrollMoveCursor(iupMatrixScrollLeftUp , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_LIN)[m +[31m-#define iupMatrixScrollLeft(ih) iupMatrixScrollMoveCursor(iupMatrixScrollLeftUp , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_COL)[m +[31m-#define iupMatrixScrollDown(ih) iupMatrixScrollMoveCursor(iupMatrixScrollRightDown , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_LIN)[m +[31m-#define iupMatrixScrollRight(ih) iupMatrixScrollMoveCursor(iupMatrixScrollRightDown , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_COL)[m +[31m-#define iupMatrixScrollPgUp(ih) iupMatrixScrollMoveCursor(iupMatrixScrollPgLeftUp , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_LIN)[m +[31m-#define iupMatrixScrollPgLeft(ih) iupMatrixScrollMoveCursor(iupMatrixScrollPgLeftUp , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_COL)[m +[31m-#define iupMatrixScrollPgDown(ih) iupMatrixScrollMoveCursor(iupMatrixScrollPgRightDown, ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_LIN)[m +[31m-#define iupMatrixScrollPgRight(ih) iupMatrixScrollMoveCursor(iupMatrixScrollPgRightDown, ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_COL)[m +[31m-#define iupMatrixScrollPosVer(ih, y) iupMatrixScrollMoveCursor(iupMatrixScrollPos , ih, IMAT_SCROLLBAR, y, IMAT_PROCESS_LIN)[m +[31m-#define iupMatrixScrollPosHor(ih, x) iupMatrixScrollMoveCursor(iupMatrixScrollPos , ih, IMAT_SCROLLBAR, x, IMAT_PROCESS_COL)[m +[32m+[m[32m#define iupMATRIX_ScrollUp(ih) iupMatrixScrollMove(iupMatrixScrollLeftUpFunc , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_LIN)[m +[32m+[m[32m#define iupMATRIX_ScrollLeft(ih) iupMatrixScrollMove(iupMatrixScrollLeftUpFunc , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_COL)[m +[32m+[m[32m#define iupMATRIX_ScrollDown(ih) iupMatrixScrollMove(iupMatrixScrollRightDownFunc , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_LIN)[m +[32m+[m[32m#define iupMATRIX_ScrollRight(ih) iupMatrixScrollMove(iupMatrixScrollRightDownFunc , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_COL)[m +[32m+[m[32m#define iupMATRIX_ScrollPgUp(ih) iupMatrixScrollMove(iupMatrixScrollPgLeftUpFunc , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_LIN)[m +[32m+[m[32m#define iupMATRIX_ScrollPgLeft(ih) iupMatrixScrollMove(iupMatrixScrollPgLeftUpFunc , ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_COL)[m +[32m+[m[32m#define iupMATRIX_ScrollPgDown(ih) iupMatrixScrollMove(iupMatrixScrollPgRightDownFunc, ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_LIN)[m +[32m+[m[32m#define iupMATRIX_ScrollPgRight(ih) iupMatrixScrollMove(iupMatrixScrollPgRightDownFunc, ih, IMAT_SCROLLBAR, 0, IMAT_PROCESS_COL)[m +[32m+[m[32m#define iupMATRIX_ScrollPosVer(ih, y) iupMatrixScrollMove(iupMatrixScrollPosFunc , ih, IMAT_SCROLLBAR, posy, IMAT_PROCESS_LIN)[m +[32m+[m[32m#define iupMATRIX_ScrollPosHor(ih, x) iupMatrixScrollMove(iupMatrixScrollPosFunc , ih, IMAT_SCROLLBAR, posx, IMAT_PROCESS_COL)[m + [m + [m + #ifdef __cplusplus[m +[1mdiff --git a/iup/srccontrols/matrix/iupmatrix.c b/iup/srccontrols/matrix/iupmatrix.c[m +[1mindex 20d618d..9e379e2 100755[m +[1m--- a/iup/srccontrols/matrix/iupmatrix.c[m +[1m+++ b/iup/srccontrols/matrix/iupmatrix.c[m +[36m@@ -76,10 +76,13 @@[m [mstatic int iMatrixSetOriginAttrib(Ihandle* ih, const char* value)[m + return 0;[m + [m + ih->data->columns.first = col;[m +[32m+[m[32m ih->data->columns.first_offset = 0;[m + ih->data->lines.first = lin;[m +[32m+[m[32m ih->data->lines.first_offset = 0;[m + [m +[31m- iupMatrixAuxUpdateVisiblePos(ih, IMAT_PROCESS_COL);[m +[31m- iupMatrixAuxUpdateVisiblePos(ih, IMAT_PROCESS_LIN);[m +[32m+[m[32m /* when "first" is changed must update scroll pos */[m +[32m+[m[32m iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_COL);[m +[32m+[m[32m iupMatrixAuxUpdateScrollPos(ih, IMAT_PROCESS_LIN);[m + [m + iupMatrixDraw(ih, 1);[m + return 0;[m +[36m@@ -109,7 +112,7 @@[m [mstatic int iMatrixSetShowAttrib(Ihandle* ih, const char* value)[m + if((lin < 1) || (col < 1))[m + return 0;[m + [m +[31m- if (!iupMatrixAuxIsCellFullVisible(ih, lin, col))[m +[32m+[m[32m if (!iupMatrixAuxIsCellStartVisible(ih, lin, col))[m + iupMatrixScrollToVisible(ih, lin, col);[m + [m + return 0;[m +[36m@@ -173,6 +176,23 @@[m [mstatic char* iMatrixGetUseTitleSizeAttrib(Ihandle* ih)[m + return "NO";[m + }[m + [m +[32m+[m[32mstatic int iMatrixSetHiddenTextMarksAttrib(Ihandle* ih, const char* value)[m +[32m+[m[32m{[m +[32m+[m[32m if (iupStrBoolean(value))[m +[32m+[m[32m ih->data->hidden_text_marks = 1;[m +[32m+[m[32m else[m[41m [m +[32m+[m[32m ih->data->hidden_text_marks = 0;[m +[32m+[m[32m return 0;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic char* iMatrixGetHiddenTextMarksAttrib(Ihandle* ih)[m +[32m+[m[32m{[m +[32m+[m[32m if (ih->data->hidden_text_marks)[m +[32m+[m[32m return "YES";[m +[32m+[m[32m else[m +[32m+[m[32m return "NO";[m +[32m+[m[32m}[m +[32m+[m + static int iMatrixSetValueAttrib(Ihandle* ih, const char* value)[m + {[m + if (IupGetInt(ih->data->datah, "VISIBLE"))[m +[36m@@ -228,14 +248,14 @@[m [mstatic char* iMatrixGetMultilineAttrib(Ihandle* ih)[m + static char* iMatrixGetNumLinAttrib(Ihandle* ih)[m + {[m + char* num = iupStrGetMemory(100);[m +[31m- sprintf(num, "%d", ih->data->lines.num-1);[m +[32m+[m[32m sprintf(num, "%d", ih->data->lines.num-1); /* the attribute does not include the title */[m + return num;[m + }[m + [m + static char* iMatrixGetNumColAttrib(Ihandle* ih)[m + {[m + char* num = iupStrGetMemory(100);[m +[31m- sprintf(num, "%d", ih->data->columns.num-1);[m +[32m+[m[32m sprintf(num, "%d", ih->data->columns.num-1); /* the attribute does not include the title */[m + return num;[m + }[m + [m +[36m@@ -427,13 +447,19 @@[m [mstatic char* iMatrixGetAlignmentAttrib(Ihandle* ih, const char* name_id)[m + align = iupAttribGet(ih, str);[m + if (!align)[m + {[m +[31m- int col;[m +[31m- if (iupStrToInt(name_id, &col))[m +[32m+[m[32m align = iupAttribGet(ih, "ALIGNMENT");[m +[32m+[m[32m if (align)[m +[32m+[m[32m return align;[m +[32m+[m[32m else[m + {[m +[31m- if (col == 0)[m +[31m- return "ALEFT";[m +[31m- else[m +[31m- return "ACENTER";[m +[32m+[m[32m int col;[m +[32m+[m[32m if (iupStrToInt(name_id, &col))[m +[32m+[m[32m {[m +[32m+[m[32m if (col == 0)[m +[32m+[m[32m return "ALEFT";[m +[32m+[m[32m else[m +[32m+[m[32m return "ACENTER";[m +[32m+[m[32m }[m + }[m + }[m + [m +[36m@@ -642,7 +668,7 @@[m [mstatic int iMatrixCreateMethod(Ihandle* ih, void **params)[m + /* Create the edit fields */[m + iupMatrixEditCreate(ih);[m + [m +[31m- /* defaults */[m +[32m+[m[32m /* defaults that are non zero */[m + ih->data->datah = ih->data->texth;[m + ih->data->mark_continuous = 1;[m + ih->data->columns.num = 1;[m +[36m@@ -656,7 +682,6 @@[m [mstatic int iMatrixCreateMethod(Ihandle* ih, void **params)[m + ih->data->mark_col1 = -1;[m + ih->data->mark_lin2 = -1;[m + ih->data->mark_col2 = -1;[m +[31m- ih->data->use_title_size = 0;[m + [m + return IUP_NOERROR;[m + }[m +[36m@@ -700,11 +725,34 @@[m [mstatic void iMatrixUnMapMethod(Ihandle* ih)[m + iupMatrixMemRelease(ih);[m + }[m + [m +[32m+[m[32mstatic char* iMatrixGetDefault(Ihandle* ih, const char* name)[m +[32m+[m[32m{[m +[32m+[m[32m int inherit;[m +[32m+[m[32m char *def_value;[m +[32m+[m[32m iupClassObjectGetAttributeInfo(ih, name, &def_value, &inherit);[m +[32m+[m[32m return def_value;[m +[32m+[m[32m}[m +[32m+[m +[32m+[m[32mstatic int iMatrixGetInt(Ihandle* ih, const char* name)[m +[32m+[m[32m{[m +[32m+[m[32m char *value = iupAttribGet(ih, name);[m +[32m+[m[32m if (!value) value = iMatrixGetDefault(ih, name);[m +[32m+[m[32m if (value)[m +[32m+[m[32m {[m +[32m+[m[32m int i = 0;[m +[32m+[m[32m if (iupStrToInt(value, &i))[m +[32m+[m[32m return i;[m +[32m+[m[32m }[m +[32m+[m[32m return 0;[m +[32m+[m[32m}[m +[32m+[m + static int iMatrixGetNaturalWidth(Ihandle* ih)[m + {[m + int width = 0, num, col;[m + [m +[31m- num = iupAttribGetInt(ih, "NUMCOL_VISIBLE")+1; /* include the title column */[m +[32m+[m[32m /* must use this custom function because[m[41m [m +[32m+[m[32m the get method for this attribute returns a value with a different meaning */[m +[32m+[m[32m num = iMatrixGetInt(ih, "NUMCOL_VISIBLE")+1; /* include the title column */[m + [m + if (iupAttribGetInt(ih, "NUMCOL_VISIBLE_LAST"))[m + {[m +[36m@@ -716,9 +764,7 @@[m [mstatic int iMatrixGetNaturalWidth(Ihandle* ih)[m + }[m + else[m + {[m +[31m- if (num > ih->data->columns.num)[m +[31m- num = ih->data->columns.num;[m +[31m- for(col = 0; col < num; col++)[m +[32m+[m[32m for(col = 0; col < num; col++) /* num can be > numcol */[m + width += iupMatrixAuxGetColumnWidth(ih, col);[m + }[m + [m +[36m@@ -729,7 +775,9 @@[m [mstatic int iMatrixGetNaturalHeight(Ihandle* ih)[m + {[m + int height = 0, num, lin;[m + [m +[31m- num = iupAttribGetInt(ih, "NUMLIN_VISIBLE")+1; /* include the title line */[m +[32m+[m[32m /* must use this custom function because[m[41m [m +[32m+[m[32m the get method for this attribute returns a value with a different meaning */[m +[32m+[m[32m num = iMatrixGetInt(ih, "NUMLIN_VISIBLE")+1; /* include the title line */[m + [m + if (iupAttribGetInt(ih, "NUMLIN_VISIBLE_LAST"))[m + {[m +[36m@@ -741,9 +789,7 @@[m [mstatic int iMatrixGetNaturalHeight(Ihandle* ih)[m + }[m + else[m + {[m +[31m- if (num > ih->data->lines.num)[m +[31m- num = ih->data->lines.num;[m +[31m- for(lin = 0; lin < num; lin++)[m +[32m+[m[32m for(lin = 0; lin < num; lin++) /* num can be > numlin */[m + height += iupMatrixAuxGetLineHeight(ih, lin);[m + }[m + [m +[36m@@ -902,6 +948,8 @@[m [mIclass* iupMatrixGetClass(void)[m + [m + /* IupMatrix Attributes - GENERAL */[m + iupClassRegisterAttribute(ic, "USETITLESIZE", iMatrixGetUseTitleSizeAttrib, iMatrixSetUseTitleSizeAttrib, IUPAF_SAMEASSYSTEM, "NO", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[32m iupClassRegisterAttribute(ic, "HIDDENTEXTMARKS", iMatrixGetHiddenTextMarksAttrib, iMatrixSetHiddenTextMarksAttrib, IUPAF_SAMEASSYSTEM, "NO", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[32m+[m[41m [m + iupClassRegisterAttribute(ic, "FRAMECOLOR", NULL, NULL, IUPAF_SAMEASSYSTEM, "100 100 100", IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "READONLY", NULL, NULL, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m + iupClassRegisterAttribute(ic, "RESIZEMATRIX", NULL, NULL, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);[m +[1mdiff --git a/iup/srcgl/Makefile b/iup/srcgl/Makefile[m +[1mindex 882d0d2..48037f0 100755[m +[1m--- a/iup/srcgl/Makefile[m +[1m+++ b/iup/srcgl/Makefile[m +[36m@@ -3,4 +3,4 @@[m + do_all: iupgl[m + [m + iupgl:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak [m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m[41m [m +[1mdiff --git a/iup/srcim/Makefile b/iup/srcim/Makefile[m +[1mindex 933ded1..d47e014 100755[m +[1m--- a/iup/srcim/Makefile[m +[1m+++ b/iup/srcim/Makefile[m +[36m@@ -3,4 +3,4 @@[m + do_all: iupim[m + [m + iupim:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak [m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m[41m [m +[1mdiff --git a/iup/srcim/iup_im.c b/iup/srcim/iup_im.c[m +[1mindex c26a3ff..ce58d80 100755[m +[1m--- a/iup/srcim/iup_im.c[m +[1m+++ b/iup/srcim/iup_im.c[m +[36m@@ -23,7 +23,7 @@[m + #include "iup_image.h"[m + [m + [m +[31m-static void PrintError(int error)[m +[32m+[m[32mstatic void iSaveErrorMsg(int error)[m + {[m + char* lang = IupGetLanguage();[m + char* msg;[m +[36m@@ -31,20 +31,22 @@[m [mstatic void PrintError(int error)[m + {[m + switch (error)[m + {[m +[32m+[m[32m case IM_ERR_NONE:[m +[32m+[m[32m msg = NULL;[m + case IM_ERR_OPEN:[m +[31m- msg = "Error Opening File.\n";[m +[32m+[m[32m msg = "Error Opening Image File.\n";[m + break;[m + case IM_ERR_MEM:[m + msg = "Insuficient memory.\n";[m + break;[m + case IM_ERR_ACCESS:[m +[31m- msg = "Error Accessing File.\n";[m +[32m+[m[32m msg = "Error Accessing Image File.\n";[m + break;[m + case IM_ERR_DATA:[m + msg = "Image type not Suported.\n";[m + break;[m + case IM_ERR_FORMAT:[m +[31m- msg = "Invalid Format.\n";[m +[32m+[m[32m msg = "Invalid Image File Format.\n";[m + break;[m + case IM_ERR_COMPRESS:[m + msg = "Invalid or unsupported compression.\n";[m +[36m@@ -57,20 +59,22 @@[m [mstatic void PrintError(int error)[m + {[m + switch (error)[m + {[m +[32m+[m[32m case IM_ERR_NONE:[m +[32m+[m[32m msg = NULL;[m + case IM_ERR_OPEN:[m +[31m- msg = "Erro Abrindo Arquivo.\n";[m +[32m+[m[32m msg = "Erro Abrindo Arquivo de Imagem.\n";[m + break;[m + case IM_ERR_MEM:[m + msg = "Memória Insuficiente.\n";[m + break;[m + case IM_ERR_ACCESS:[m +[31m- msg = "Erro Acessando Arquivo.\n";[m +[32m+[m[32m msg = "Erro Acessando Arquivo de Imagem.\n";[m + break;[m + case IM_ERR_DATA:[m + msg = "Tipo de Imagem não Suportado.\n";[m + break;[m + case IM_ERR_FORMAT:[m +[31m- msg = "Formato Inválido.\n";[m +[32m+[m[32m msg = "Formato de Arquivo de Imagem Inválido.\n";[m + break;[m + case IM_ERR_COMPRESS:[m + msg = "Compressão Inválida ou não Suportada.\n";[m +[36m@@ -80,7 +84,7 @@[m [mstatic void PrintError(int error)[m + }[m + }[m + [m +[31m- IupMessage("Error", msg);[m +[32m+[m[32m IupSetGlobal("IUPIM_LASTERROR", msg);[m + }[m + [m + Ihandle* IupLoadImage(const char* file_name)[m +[36m@@ -165,7 +169,7 @@[m [mload_finish:[m + imCounterSetCallback(NULL, old_callback);[m + if (ifile) imFileClose(ifile);[m + if (image_data) free(image_data);[m +[31m- if (error) PrintError(error);[m +[32m+[m[32m iSaveErrorMsg(error);[m + return iup_image;[m + }[m + [m +[36m@@ -188,7 +192,7 @@[m [mint IupSaveImage(Ihandle* ih, const char* file_name, const char* format)[m + ifile = imFileNew(file_name, format, &error);[m + if (!ifile)[m + {[m +[31m- PrintError(error);[m +[32m+[m[32m iSaveErrorMsg(error);[m + return 0;[m + }[m + [m +[36m@@ -238,8 +242,7 @@[m [mint IupSaveImage(Ihandle* ih, const char* file_name, const char* format)[m + [m + imFileClose(ifile); [m + [m +[31m- if (error)[m +[31m- PrintError(error);[m +[32m+[m[32m iSaveErrorMsg(error);[m + [m + return error == IM_ERR_NONE? 1: 0;[m + }[m +[1mdiff --git a/iup/srcimglib/Makefile b/iup/srcimglib/Makefile[m +[1mindex 261537a..873715f 100755[m +[1m--- a/iup/srcimglib/Makefile[m +[1m+++ b/iup/srcimglib/Makefile[m +[36m@@ -3,4 +3,4 @@[m + do_all: iupimglib[m + [m + iupimglib:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m +[1mdiff --git a/iup/srcledc/Makefile b/iup/srcledc/Makefile[m +[1mindex 8854269..71b9235 100755[m +[1m--- a/iup/srcledc/Makefile[m +[1m+++ b/iup/srcledc/Makefile[m +[36m@@ -3,4 +3,4 @@[m + do_all: ledc[m + [m + ledc:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak [m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m[41m [m +[1mdiff --git a/iup/srclua3/Makefile b/iup/srclua3/Makefile[m +[1mindex b63716a..0551725 100755[m +[1m--- a/iup/srclua3/Makefile[m +[1m+++ b/iup/srclua3/Makefile[m +[36m@@ -3,19 +3,19 @@[m + do_all: iuplua iupluacd iupluacontrols iuplua_pplot iupluagl iupluaim[m + [m + iuplua:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak [m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m[41m [m + [m + iupluacd:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iupcd[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iupcd[m + [m + iupluacontrols:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iupcontrols[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iupcontrols[m + [m + iuplua_pplot:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iup_pplot[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iup_pplot[m + [m + iupluagl:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iupgl[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iupgl[m + [m + iupluaim:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iupim[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iupim[m +[1mdiff --git a/iup/srclua3/config.mak b/iup/srclua3/config.mak[m +[1mindex fae6145..a3ffb1d 100755[m +[1m--- a/iup/srclua3/config.mak[m +[1m+++ b/iup/srclua3/config.mak[m +[36m@@ -6,9 +6,9 @@[m [mOPT = YES[m + [m + LOHDIR = loh[m + SRCLUA = iuplua.lua iuplua_widgets.lua constants.lua spin.lua \[m +[31m- sbox.lua val.lua tree.lua tabs.lua[m +[32m+[m[32m sbox.lua split.lua val.lua tree.lua tabs.lua[m + SRC = iuplua.c iuplua_api.c iuplua_widgets.c il_scanf.c il_cbox.c \[m +[31m- il_sbox.c il_spin.c il_val.c il_tree.c il_tabs.c il_getcolor.c il_getparam.c[m +[32m+[m[32m il_sbox.c il_split.c il_spin.c il_val.c il_tree.c il_tabs.c il_getcolor.c il_getparam.c[m + [m + USE_LUA = Yes[m + [m +[1mdiff --git a/iup/srclua3/il.h b/iup/srclua3/il.h[m +[1mindex 406ccc4..63f9866 100755[m +[1m--- a/iup/srclua3/il.h[m +[1m+++ b/iup/srclua3/il.h[m +[36m@@ -15,6 +15,7 @@[m [mint iupluaapi_open(void);[m + int iupluawidgets_open(int tag);[m + [m + int sboxlua_open(void);[m +[32m+[m[32mint splitlua_open(void);[m + int spinlua_open(void);[m + int cboxlua_open(void);[m + int gclua_open (void);[m +[1mdiff --git a/iup/srclua3/il_getparam.c b/iup/srclua3/il_getparam.c[m +[1mindex 28a41be..6005ce8 100755[m +[1m--- a/iup/srclua3/il_getparam.c[m +[1m+++ b/iup/srclua3/il_getparam.c[m +[36m@@ -93,6 +93,8 @@[m [mstatic void GetParam(void)[m + param_data[i] = malloc(sizeof(float));[m + *(float*)(param_data[i]) = (float)luaL_check_number(lua_param_start); lua_param_start++;[m + break;[m +[32m+[m[32m case 'f':[m +[32m+[m[32m case 'c':[m + case 's':[m + case 'm':[m + s = luaL_check_string(lua_param_start); lua_param_start++;[m +[36m@@ -136,6 +138,8 @@[m [mstatic void GetParam(void)[m + case 'r':[m + lua_pushnumber(*(float*)(param_data[i]));[m + break;[m +[32m+[m[32m case 'f':[m +[32m+[m[32m case 'c':[m + case 's':[m + case 'm':[m + lua_pushstring((char*)(param_data[i]));[m +[1mdiff --git a/iup/srclua3/il_tree.c b/iup/srclua3/il_tree.c[m +[1mindex 8d5fcf8..5d145bf 100755[m +[1m--- a/iup/srclua3/il_tree.c[m +[1m+++ b/iup/srclua3/il_tree.c[m +[36m@@ -91,6 +91,29 @@[m [mstatic int TREE_multiselection (Ihandle *handle, int *ids, int n)[m + return iuplua_call();[m + }[m + [m +[32m+[m[32mstatic int TREE_multiunselection (Ihandle *handle, int *ids, int n)[m +[32m+[m[32m{[m +[32m+[m[32m int i;[m +[32m+[m[32m lua_Object tb;[m +[32m+[m +[32m+[m[32m iuplua_call_start(handle, "multiunselection");[m +[32m+[m +[32m+[m[32m tb = lua_createtable();[m +[32m+[m[32m for (i = 0; i < n; i++)[m[41m [m +[32m+[m[32m {[m +[32m+[m[32m lua_beginblock();[m +[32m+[m[32m lua_pushobject(tb);[m +[32m+[m[32m lua_pushnumber(i+1);[m +[32m+[m[32m lua_pushnumber(ids[i]);[m +[32m+[m[32m lua_settable();[m +[32m+[m[32m lua_endblock();[m[41m [m +[32m+[m[32m }[m +[32m+[m[32m lua_pushobject(tb);[m +[32m+[m +[32m+[m[32m lua_pushnumber (n);[m +[32m+[m[32m return iuplua_call();[m +[32m+[m[32m}[m +[32m+[m + static int TREE_dragdrop(Ihandle* handle, int drag_id, int drop_id, int isshift, int iscontrol)[m + {[m + iuplua_call_start(handle, "dragdrop");[m +[36m@@ -232,6 +255,7 @@[m [mint treelua_open(void)[m + lua_CFunction func;[m + } TreeAssocList [] = {[m + {"iup_tree_multiselection_cb", (lua_CFunction)TREE_multiselection},[m +[32m+[m[32m {"iup_tree_multiunselection_cb", (lua_CFunction)TREE_multiunselection},[m + {"iup_tree_selection_cb", (lua_CFunction)TREE_selection},[m + {"iup_tree_branchopen_cb", (lua_CFunction)TREE_branchopen},[m + {"iup_tree_branchclose_cb", (lua_CFunction)TREE_branchclose},[m +[1mdiff --git a/iup/srclua3/iuplua.c b/iup/srclua3/iuplua.c[m +[1mindex 7789ce8..5563699 100755[m +[1m--- a/iup/srclua3/iuplua.c[m +[1m+++ b/iup/srclua3/iuplua.c[m +[36m@@ -481,6 +481,7 @@[m [mint iuplua_open(void)[m + iupluawidgets_open(iuplua_tag);[m + [m + sboxlua_open();[m +[32m+[m[32m splitlua_open();[m + spinlua_open();[m + cboxlua_open();[m + vallua_open();[m +[1mdiff --git a/iup/srclua3/iuplua_api.c b/iup/srclua3/iuplua_api.c[m +[1mindex 3221658..a9acf1d 100755[m +[1m--- a/iup/srclua3/iuplua_api.c[m +[1m+++ b/iup/srclua3/iuplua_api.c[m +[36m@@ -182,7 +182,7 @@[m [mstatic void GetAttribute(void)[m + char *name = luaL_check_string(2);[m + Ihandle* ih = iuplua_checkihandle(1);[m + char *value = IupGetAttribute(ih, name);[m +[31m- if (!value || iupAttribIsInternal(name))[m +[32m+[m[32m if (!value || iupATTRIB_ISINTERNAL(name))[m + lua_pushnil();[m + else[m + {[m +[1mdiff --git a/iup/srclua3/iuplua_widgets.c b/iup/srclua3/iuplua_widgets.c[m +[1mindex f6b801b..7591580 100755[m +[1m--- a/iup/srclua3/iuplua_widgets.c[m +[1m+++ b/iup/srclua3/iuplua_widgets.c[m +[36m@@ -170,6 +170,12 @@[m [mstatic int iupluaUnMapCb(Ihandle* handle)[m + return iuplua_call();[m + }[m + [m +[32m+[m[32mstatic int iupluaDestroyCb(Ihandle* handle)[m +[32m+[m[32m{[m +[32m+[m[32m iuplua_call_start(handle, "destroycb");[m +[32m+[m[32m return iuplua_call();[m +[32m+[m[32m}[m +[32m+[m + static int iupluaMapCb(Ihandle* handle)[m + {[m + iuplua_call_start(handle, "mapcb");[m +[36m@@ -610,6 +616,7 @@[m [mint iupluawidgets_open(int tag)[m + { "iup_show_cb", (lua_CFunction)dialog_show},[m + { "iup_map_cb", (lua_CFunction)iupluaMapCb},[m + { "iup_unmap_cb", (lua_CFunction)iupluaUnMapCb},[m +[32m+[m[32m { "iup_destroy_cb", (lua_CFunction)iupluaDestroyCb},[m + { "iup_dropfiles_cb", (lua_CFunction)iupluaDropfilesCb},[m + { "iup_trayclick_cb", (lua_CFunction)dialog_trayclick},[m + { "iup_getfocus_cb", (lua_CFunction)iupluaGetfocusCb},[m +[1mdiff --git a/iup/srclua3/iuplua_widgets.lua b/iup/srclua3/iuplua_widgets.lua[m +[1mindex 33be9e3..a59bde6 100755[m +[1m--- a/iup/srclua3/iuplua_widgets.lua[m +[1m+++ b/iup/srclua3/iuplua_widgets.lua[m +[36m@@ -875,6 +875,7 @@[m [miup_callbacks =[m + showcb = {"SHOW_CB", iup_show_cb},[m + mapcb = {"MAP_CB", iup_map_cb},[m + unmapcb = {"UNMAP_CB", iup_unmap_cb},[m +[32m+[m[32m destroycb = {"DESTROY_CB", iup_destroy_cb},[m + dropfiles = {"DROPFILES_CB", iup_dropfiles_cb},[m + menuclose = {"MENUCLOSE_CB", iup_menuclose_cb},[m + highlight = {"HIGHLIGHT_CB", iup_highlight_cb},[m +[36m@@ -921,6 +922,7 @@[m [miup_callbacks.open_cb = iup_callbacks.open[m + iup_callbacks.show_cb = iup_callbacks.showcb [m + iup_callbacks.map_cb = iup_callbacks.mapcb [m + iup_callbacks.unmap_cb = iup_callbacks.unmapcb [m +[32m+[m[32miup_callbacks.destroy_cb = iup_callbacks.destroycb[m[41m [m + iup_callbacks.dropfiles_cb = iup_callbacks.dropfiles [m + iup_callbacks.menuclose_cb = iup_callbacks.menuclose [m + iup_callbacks.highlight_cb = iup_callbacks.highlight [m +[1mdiff --git a/iup/srclua3/tree.lua b/iup/srclua3/tree.lua[m +[1mindex 659afdb..bf53bca 100755[m +[1m--- a/iup/srclua3/tree.lua[m +[1m+++ b/iup/srclua3/tree.lua[m +[36m@@ -47,6 +47,7 @@[m [miup.TreeSetValue = TreeSetValue[m + [m + iup_callbacks.selection = {"SELECTION_CB", iup_tree_selection_cb}[m + iup_callbacks.multiselection = {"MULTISELECTION_CB", iup_tree_multiselection_cb}[m +[32m+[m[32miup_callbacks.multiunselection = {"MULTIUNSELECTION_CB", iup_tree_multiunselection_cb}[m + iup_callbacks.branchopen = {"BRANCHOPEN_CB", iup_tree_branchopen_cb}[m + iup_callbacks.branchclose = {"BRANCHCLOSE_CB", iup_tree_branchclose_cb}[m + iup_callbacks.executeleaf = {"EXECUTELEAF_CB", iup_tree_executeleaf_cb}[m +[36m@@ -58,6 +59,7 @@[m [miup_callbacks.dragdrop = {"DRAGDROP_CB", iup_tree_dragdrop_cb}[m + [m + iup_callbacks.selection_cb = iup_callbacks.selection [m + iup_callbacks.multiselection_cb = iup_callbacks.multiselection [m +[32m+[m[32miup_callbacks.multiunselection_cb = iup_callbacks.multiunselection[m[41m [m + iup_callbacks.branchopen_cb = iup_callbacks.branchopen [m + iup_callbacks.branchclose_cb = iup_callbacks.branchclose [m + iup_callbacks.executeleaf_cb = iup_callbacks.executeleaf [m +[1mdiff --git a/iup/srclua5/Makefile b/iup/srclua5/Makefile[m +[1mindex 3942e79..1189d32 100755[m +[1m--- a/iup/srclua5/Makefile[m +[1m+++ b/iup/srclua5/Makefile[m +[36m@@ -3,22 +3,22 @@[m + do_all: iuplua iupluacd iupluacontrols iuplua_pplot iupluagl iupluaim iupluaimglib[m + [m + iuplua:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak [m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak[m[41m [m + [m + iupluacd:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iupcd[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iupcd[m + [m + iupluacontrols:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iupcontrols[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iupcontrols[m + [m + iuplua_pplot:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iup_pplot[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iup_pplot[m + [m + iupluagl:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iupgl[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iupgl[m + [m + iupluaim:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iupim[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iupim[m + [m + iupluaimglib:[m +[31m- @$(MAKE) --no-print-directory -f ../tecmake_compact.mak MF=iupimglib[m +[32m+[m [32m@$(MAKE) --no-print-directory -f ../tecmake.mak MF=iupimglib[m +[1mdiff --git a/iup/srclua5/button.lua b/iup/srclua5/button.lua[m +[1mindex 946a05e..fc57b1a 100755[m +[1m--- a/iup/srclua5/button.lua[m +[1m+++ b/iup/srclua5/button.lua[m +[36m@@ -3,16 +3,16 @@[m + ------------------------------------------------------------------------------[m + local ctrl = {[m + nick = "button",[m +[31m- parent = WIDGET,[m +[32m+[m[32m parent = iup.WIDGET,[m + creation = "S-",[m + callback = {[m + action = "", [m + }[m + } [m + [m +[31m-function ctrl.createElement(class, arg)[m +[31m- return Button(arg.title)[m +[32m+[m[32mfunction ctrl.createElement(class, param)[m +[32m+[m[32m return iup.Button(param.title)[m + end[m + [m +[31m-iupRegisterWidget(ctrl)[m +[31m-iupSetClass(ctrl, "iup widget")[m +[32m+[m[32miup.RegisterWidget(ctrl)[m +[32m+[m[32miup.SetClass(ctrl, "iup widget")[m +[1mdiff --git a/iup/srclua5/canvas.lua b/iup/srclua5/canvas.lua[m +[1mindex 562d671..101c4f4 100755[m +[1m--- a/iup/srclua5/canvas.lua[m +[1m+++ b/iup/srclua5/canvas.lua[m +[36m@@ -3,7 +3,7 @@[m + ------------------------------------------------------------------------------[m + local ctrl = {[m + nick = "canvas",[m +[31m- parent = WIDGET,[m +[32m+[m[32m parent = iup.WIDGET,[m + creation = "-",[m + callback = {[m + action = "ff",[m +[36m@@ -21,9 +21,9 @@[m [mlocal ctrl = {[m + }[m + }[m + [m +[31m-function ctrl.createElement(class, arg)[m +[31m- return Canvas()[m +[32m+[m[32mfunction ctrl.createElement(class, param)[m +[32m+[m[32m return iup.Canvas()[m + end[m + [m +[31m-iupRegisterWidget(ctrl)[m +[31m-iupSetClass(ctrl, "iup widget")[m +[32m+[m[32miup.RegisterWidget(ctrl)[m +[32m+[m[32miup.SetClass(ctrl, "iup widget")[m +[1mdiff --git a/iup/srclua5/cbox.lua b/iup/srclua5/cbox.lua[m +[1mindex 3533970..81ba9be 100755[m +[1m--- a/iup/srclua5/cbox.lua[m +[1m+++ b/iup/srclua5/cbox.lua[m +[36m@@ -3,7 +3,7 @@[m + ------------------------------------------------------------------------------[m + local ctrl = {[m + nick = "cbox",[m +[31m- parent = WIDGET,[m +[32m+[m[32m parent = iup.WIDGET,[m + creation = "v",[m + callback = {},[m + funcname = "Cboxv",[m +[36m@@ -20,9 +20,9 @@[m [mstatic int Cboxv(lua_State *L)[m + ]],[m + }[m + [m +[31m-function ctrl.createElement(class, arg)[m +[31m- return Cboxv(arg)[m +[32m+[m[32mfunction ctrl.createElement(class, param)[m +[32m+[m[32m return iup.Cboxv(param)[m + end[m + [m +[31m-iupRegisterWidget(ctrl)[m +[31m-iupSetClass(ctrl, "iup widget")[m +[32m+[m[32miup.RegisterWidget(ctrl)[m +[32m+[m[32miup.SetClass(ctrl, "iup widget")[m +[1mdiff --git a/iup/srclua5/cells.lua b/iup/srclua5/cells.lua[m +[1mindex 9c914f2..0355b17 100755[m +[1m--- a/iup/srclua5/cells.lua[m +[1m+++ b/iup/srclua5/cells.lua[m +[36m@@ -3,7 +3,7 @@[m + ------------------------------------------------------------------------------[m + local ctrl = {[m + nick = "cells",[m +[31m- parent = WIDGET,[m +[32m+[m[32m parent = iup.WIDGET,[m + creation = "",[m + callback = {[m + mouseclick_cb = "nnnnnns",[m +[36m@@ -24,9 +24,9 @@[m [mfunction ctrl.redraw(handle)[m + handle.repaint = "YES"[m + end[m + [m +[31m-function ctrl.createElement(class, arg)[m +[31m- return Cells()[m +[32m+[m[32mfunction ctrl.createElement(class, param)[m +[32m+[m[32m return iup.Cells()[m + end[m + [m +[31m-iupRegisterWidget(ctrl)[m +[31m-iupSetClass(ctrl, "iup widget")[m +[32m+[m[32miup.RegisterWidget(ctrl)[m +[32m+[m[32miup.SetClass(ctrl, "iup widget")[m +[1mdiff --git a/iup/srclua5/clipboard.lua b/iup/srclua5/clipboard.lua[m +[1mindex e60b8bd..663215b 100755[m +[1m--- a/iup/srclua5/clipboard.lua[m +[1m+++ b/iup/srclua5/clipboard.lua[m +[36m@@ -3,15 +3,15 @@[m + ------------------------------------------------------------------------------[m + local ctrl = {[m + nick = "clipboard",[m +[31m- parent = WIDGET,[m +[32m+[m[32m parent = iup.WIDGET,[m + creation = "",[m + callback = {[m + },[m + } [m + [m +[31m-function ctrl.createElement(class, arg)[m +[31m- return Clipboard()[m +[32m+[m[32mfunction ctrl.createElement(class, param)[m +[32m+[m[32m return iup.Clipboard()[m + end[m + [m +[31m-iupRegisterWidget(ctrl)[m +[31m-iupSetClass(ctrl, "iup widget")[m +[32m+[m[32miup.RegisterWidget(ctrl)[m +[32m+[m[32miup.SetClass(ctrl, "iup widget")[m +[1mdiff --git a/iup/srclua5/colorbar.lua b/iup/srclua5/colorbar.lua[m +[1mindex 524d5f3..7cc07db 100755[m +[1m--- a/iup/srclua5/colorbar.lua[m +[1m+++ b/iup/srclua5/colorbar.lua[m +[36m@@ -3,7 +3,7 @@[m + ------------------------------------------------------------------------------[m + local ctrl = {[m + nick = "colorbar",[m +[31m- parent = WIDGET,[m +[32m+[m[32m parent = iup.WIDGET,[m + creation = "",[m + callback = {[m + select_cb = "nn",[m +[36m@@ -15,12 +15,12 @@[m [mlocal ctrl = {[m + include = "iupcontrols.h",[m + }[m + [m +[31m-PRIMARY = -1[m +[31m-SECONDARY = -2[m +[32m+[m[32miup.PRIMARY = -1[m +[32m+[m[32miup.SECONDARY = -2[m + [m +[31m-function ctrl.createElement(class, arg)[m +[31m- return Colorbar(arg.action)[m +[32m+[m[32mfunction ctrl.createElement(class, param)[m +[32m+[m[32m return iup.Colorbar(param.action)[m + end[m + [m +[31m-iupRegisterWidget(ctrl)[m +[31m-iupSetClass(ctrl, "iup widget")[m +[32m+[m[32miup.RegisterWidget(ctrl)[m +[32m+[m[32miup.SetClass(ctrl, "iup widget")[m +[1mdiff --git a/iup/srclua5/colorbrowser.lua b/iup/srclua5/colorbrowser.lua[m +[1mindex 16ac58f..496ce21 100755[m +[1m--- a/iup/srclua5/colorbrowser.lua[m +[1m+++ b/iup/srclua5/colorbrowser.lua[m +[36m@@ -3,7 +3,7 @@[m + ------------------------------------------------------------------------------[m + local ctrl = {[m + nick = "colorbrowser",[m +[31m- parent = WIDGET,[m +[32m+[m[32m parent = iup.WIDGET,[m + creation = "",[m + callback = {[m + drag_cb = "ccc",[m +[36m@@ -13,9 +13,9 @@[m [mlocal ctrl = {[m + include = "iupcontrols.h",[m + }[m + [m +[31m-function ctrl.createElement(class, arg)[m +[31m- return ColorBrowser(arg.action)[m +[32m+[m[32mfunction ctrl.createElement(class, param)[m +[32m+[m[32m return iup.ColorBrowser(param.action)[m + end[m + [m +[31m-iupRegisterWidget(ctrl)[m +[31m-iupSetClass(ctrl, "iup widget")[m +[32m+[m[32miup.RegisterWidget(ctrl)[m +[32m+[m[32miup.SetClass(ctrl, "iup widget")[m +[1mdiff --git a/iup/srclua5/colordlg.lua b/iup/srclua5/colordlg.lua[m +[1mindex 6eea53b..d6a71a4 100755[m +[1m--- a/iup/srclua5/colordlg.lua[m +[1m+++ b/iup/srclua5/colordlg.lua[m +[36m@@ -3,24 +3,24 @@[m + ------------------------------------------------------------------------------[m + local ctrl = {[m + nick = "colordlg",[m +[31m- parent = WIDGET,[m +[32m+[m[32m parent = iup.WIDGET,[m + creation = "",[m + funcname = "ColorDlg",[m + callback = {}[m + } [m + [m + function ctrl.popup(handle, x, y)[m +[31m- Popup(handle,x,y)[m +[32m+[m[32m iup.Popup(handle,x,y)[m + end[m + [m + function ctrl.destroy(handle)[m +[31m- return Destroy(handle)[m +[32m+[m[32m return iup.Destroy(handle)[m + end[m + [m +[31m-function ctrl.createElement(class, arg)[m +[31m- return ColorDlg()[m +[32m+[m[32mfunction ctrl.createElement(class, param)[m +[32m+[m[32m return iup.ColorDlg()[m + end[m + [m +[31m-iupRegisterWidget(ctrl)[m +[31m-iupSetClass(ctrl, "iup widget")[m +[32m+[m[32miup.RegisterWidget(ctrl)[m +[32m+[m[32miup.SetClass(ctrl, "iup widget")[m + [m +[1mdiff --git a/iup/srclua5/config.mak b/iup/srclua5/config.mak[m +[1mindex 7979f0e..921aa29 100755[m +[1m--- a/iup/srclua5/config.mak[m +[1m+++ b/iup/srclua5/config.mak[m +[36m@@ -17,7 +17,7 @@[m [mCTRLUA = button.lua canvas.lua dialog.lua colordlg.lua clipboard.lua \[m + item.lua image.lua imagergb.lua imagergba.lua label.lua \[m + menu.lua multiline.lua list.lua separator.lua user.lua \[m + submenu.lua text.lua toggle.lua vbox.lua zbox.lua timer.lua \[m +[31m- sbox.lua spin.lua spinbox.lua cbox.lua messagedlg.lua \[m +[32m+[m[32m sbox.lua split.lua spin.lua spinbox.lua cbox.lua messagedlg.lua \[m + radio.lua val.lua tabs.lua fontdlg.lua tree.lua progressbar.lua[m + [m + GC := $(addsuffix .c, $(basename $(CTRLUA)))[m +[1mdiff --git a/iup/srclua5/constants.lua b/iup/srclua5/constants.lua[m +[1mindex 9a72f6a..2a1e76f 100755[m +[1m--- a/iup/srclua5/constants.lua[m +[1m+++ b/iup/srclua5/constants.lua[m +[36m@@ -3,70 +3,70 @@[m + ----------------------------------------------------------------------------[m + -- Common return values [m + ----------------------------------------------------------------------------[m +[31m-ERROR = 1[m +[31m-NOERROR = 0[m +[31m-OPENED = -1[m +[31m-INVALID = -1[m +[32m+[m[32miup.ERROR = 1[m +[32m+[m[32miup.NOERROR = 0[m +[32m+[m[32miup.OPENED = -1[m +[32m+[m[32miup.INVALID = -1[m + [m + ----------------------------------------------------------------------------[m + -- Callback return values [m + ----------------------------------------------------------------------------[m +[31m-IGNORE = -1[m +[31m-DEFAULT = -2[m +[31m-CLOSE = -3[m +[31m-CONTINUE = -4[m +[32m+[m[32miup.IGNORE = -1[m +[32m+[m[32miup.DEFAULT = -2[m +[32m+[m[32miup.CLOSE = -3[m +[32m+[m[32miup.CONTINUE = -4[m + [m + ----------------------------------------------------------------------------[m + -- IupPopup e IupShowXY [m + -------------------------------
\ No newline at end of file |