diff options
author | Pixel <pixel@nobis-crew.org> | 2010-06-15 00:59:57 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2010-06-15 00:59:57 -0700 |
commit | eed0eb6a476d54ce19aeff137984aa981d9e3976 (patch) | |
tree | 807891636efd2f87dcbd261e971216269973ae07 /iup/srcview | |
parent | ccc8261e4d48de89da4ddfe7b55e378ae0cd6f47 (diff) |
Upgrading to iup 3.1
Diffstat (limited to 'iup/srcview')
-rwxr-xr-x | iup/srcview/Makefile | 4 | ||||
-rwxr-xr-x | iup/srcview/config.mak | 29 | ||||
-rwxr-xr-x | iup/srcview/iup_view.c | 66 | ||||
-rwxr-xr-x | iup/srcview/make_uname.bat | 8 |
4 files changed, 80 insertions, 27 deletions
diff --git a/iup/srcview/Makefile b/iup/srcview/Makefile index 1779960..e49c397 100755 --- a/iup/srcview/Makefile +++ b/iup/srcview/Makefile @@ -3,7 +3,7 @@ do_all: iupview iupview: - @$(MAKE) --no-print-directory -f ../tecmake_compact.mak + @$(MAKE) --no-print-directory -f ../tecmake.mak iupviewgtk: - @$(MAKE) --no-print-directory -f ../tecmake_compact.mak USE_GTK=Yes + @$(MAKE) --no-print-directory -f ../tecmake.mak USE_GTK=Yes diff --git a/iup/srcview/config.mak b/iup/srcview/config.mak index 4967582..9d03f3e 100755 --- a/iup/srcview/config.mak +++ b/iup/srcview/config.mak @@ -12,18 +12,17 @@ USE_CD = Yes USE_IUPCONTROLS = Yes USE_IUP3 = Yes -# ifdef USE_GTK -# ifndef GTK_DEFAULT -# # Build GTK version in IRIX,SunOS,AIX,Win32 -# APPNAME = iupviewgtk -# endif -# else -# ifdef GTK_DEFAULT -# # Build Motif version in Linux,Darwin,FreeBSD -# USE_MOTIF = Yes -# APPNAME = iupviewmot -# endif -# endif +ifdef GTK_DEFAULT + ifdef USE_MOTIF + # Build Motif version in Linux,Darwin,FreeBSD + APPNAME = iupviewmot + endif +else + ifdef USE_GTK + # Build GTK version in IRIX,SunOS,AIX,Win32 + APPNAME = iupviewgtk + endif +endif ifeq "$(TEC_UNAME)" "SunOS510x86" DEFINES = USE_NO_OPENGL @@ -37,7 +36,11 @@ ifdef USE_IM ifneq ($(findstring Win, $(TEC_SYSNAME)), ) LIBS = iupim iupimglib else - IUPLIB = $(IUP)/lib/$(TEC_UNAME) + ifdef DBG_DIR + IUPLIB = $(IUP)/lib/$(TEC_UNAME)d + else + IUPLIB = $(IUP)/lib/$(TEC_UNAME) + endif SLIB = $(IUPLIB)/libiupim.a $(IUPLIB)/libiupimglib.a endif endif diff --git a/iup/srcview/iup_view.c b/iup/srcview/iup_view.c index f6d400b..b2c877b 100755 --- a/iup/srcview/iup_view.c +++ b/iup/srcview/iup_view.c @@ -7,10 +7,12 @@ #include "iup.h" #include "iupcontrols.h" #include "iupgl.h" + #include "iup_str.h" +#include "iup_object.h" -#define MAX_NAMES 500 +#define MAX_NAMES 5000 #ifdef USE_IM #include "iupim.h" @@ -234,8 +236,13 @@ static int saveallimages_cb(void) if (!IupSaveImageAsText(elem, file_name, imgtype, names[i])) { #ifdef USE_IM - if (!IupSaveImage(elem, file_name, StrUpper(imgtype))) /* already displayed an error message */ + if (!IupSaveImage(elem, file_name, StrUpper(imgtype))) + { + char* err_msg = IupGetGlobal("IUPIM_LASTERROR"); + if (err_msg) + IupMessage("Error", err_msg); return IUP_DEFAULT; + } #else IupMessage("Error", "Failed to save the image."); return IUP_DEFAULT; @@ -434,11 +441,19 @@ static int saveimage_cb(Ihandle* self) if (GetSaveAsFile(file_name, imgtype) != -1) { if (!IupSaveImageAsText(elem, file_name, imgtype, name)) + { #ifdef USE_IM - IupSaveImage(elem, file_name, StrUpper(imgtype)); /* already displayed an error message */ + if (!IupSaveImage(elem, file_name, StrUpper(imgtype))) + { + char* err_msg = IupGetGlobal("IUPIM_LASTERROR"); + if (err_msg) + IupMessage("Error", err_msg); + return IUP_DEFAULT; + } #else IupMessage("Error", "Failed to save the image."); #endif + } } } else @@ -544,16 +559,44 @@ static void mainUpdateInternals(void) } } +static int checkArray(Ihandle* *ih_array, int count, Ihandle* ih) +{ + int i; + for (i = 0; i < count; i++) + { + if (ih_array[i] == ih) + return 0; + } + return 1; +} + static int destroyall_cb(Ihandle* self) { char *names[MAX_NAMES]; + Ihandle* ih; + Ihandle* ih_names[MAX_NAMES]; Ihandle* list = (Ihandle*)IupGetAttribute(self, "mainList"); - int i, num_names = IupGetAllNames(names, MAX_NAMES); + int i, j=0, num_names = IupGetAllNames(names, MAX_NAMES); for (i = 0; i < num_names; i++) { - Ihandle* elem = IupGetHandle(names[i]); + ih = IupGetHandle(names[i]); + if (iupObjectCheck(ih) && IupGetInt(ih, "_INTERNAL") == 0) + { + ih = IupGetDialog(ih); + if (checkArray(ih_names, j, ih)) + { + ih_names[j] = ih; + j++; + } + } + } + num_names = j; + + for (i = 0; i < num_names; i++) + { + Ihandle* elem = ih_names[i]; - if (elem && IupGetInt(elem, "_INTERNAL") == 0) + if (iupObjectCheck(elem)) { char* type = IupGetClassName(elem); @@ -567,6 +610,7 @@ static int destroyall_cb(Ihandle* self) } } } + IupSetAttribute(list, "1", NULL); IupSetAttribute(list, "VALUE", "1"); return IUP_DEFAULT; @@ -689,6 +733,12 @@ static void LoadImageFile(Ihandle* self, const char* file_name) free(file_title); mainUpdateList(self, file_name); } + else + { + char* err_msg = IupGetGlobal("IUPIM_LASTERROR"); + if (err_msg) + IupMessage("Error", err_msg); + } } static int GetOpenFileName(char* file) @@ -803,6 +853,7 @@ static Ihandle* mainDialog(void) IupFrame(label = IupLabel("")), NULL); IupSetAttribute(box, "MARGIN", "10x10"); + IupSetAttribute(list, "SORT", "YES"); IupSetCallback(list, "ACTION", (Icallback)list_cb); IupSetCallback(list, "DBLCLICK_CB", (Icallback)list_dbclick_cb); @@ -817,6 +868,7 @@ static Ihandle* mainDialog(void) IupSetAttribute(main_dialog, "mainLabel", (char*)label); IupSetCallback(main_dialog, "CLOSE_CB", (Icallback)close_cb); IupSetCallback(main_dialog, "DROPFILES_CB", (Icallback)dropfile_cb); + IupSetAttribute(main_dialog, "_INTERNAL", "YES"); IupSetAttribute(menu, "mainList", (char*)list); IupSetAttribute(menu, "mainLabel", (char*)label); @@ -841,8 +893,6 @@ int main (int argc, char **argv) IupShow(main_dialog); IupMainLoop(); - destroyall_cb(main_dialog); - IupDestroy(main_dialog); IupControlsClose(); IupClose(); diff --git a/iup/srcview/make_uname.bat b/iup/srcview/make_uname.bat index ab63bd3..1a98efe 100755 --- a/iup/srcview/make_uname.bat +++ b/iup/srcview/make_uname.bat @@ -8,19 +8,19 @@ goto end :iupexe32 call tecmake vc8 relink %2 %3 %4 %5 %6 %7 -#call tecmake vc8 "USE_GTK=Yes" relink %2 %3 %4 %5 %6 %7 +REM call tecmake vc8 "USE_GTK=Yes" relink %2 %3 %4 %5 %6 %7 goto end :iupexe64 call tecmake vc8_64 relink %2 %3 %4 %5 %6 %7 -#call tecmake vc8_64 "USE_GTK=Yes" relink %2 %3 %4 %5 %6 %7 +REM call tecmake vc8_64 "USE_GTK=Yes" relink %2 %3 %4 %5 %6 %7 goto end :iupexe call tecmake vc8 relink %2 %3 %4 %5 %6 %7 -#call tecmake vc8 "USE_GTK=Yes" relink %2 %3 %4 %5 %6 %7 +REM call tecmake vc8 "USE_GTK=Yes" relink %2 %3 %4 %5 %6 %7 call tecmake vc8_64 relink %2 %3 %4 %5 %6 %7 -#call tecmake vc8_64 "USE_GTK=Yes" relink %2 %3 %4 %5 %6 %7 +REM call tecmake vc8_64 "USE_GTK=Yes" relink %2 %3 %4 %5 %6 %7 goto end :end |