From fdf8fa658f796ff993527e6d9f48e074e157616b Mon Sep 17 00:00:00 2001 From: Tobias Boege Date: Tue, 15 May 2018 21:27:51 +0200 Subject: [PATCH 1/8] gb.pdf: Compile with poppler 0.64 [GB.PDF] * NEW: Add many consts to compile with poppler 0.64. Partial patch thanks to Tony Morehen --- gb.pdf/src/CPdfDocument.cpp | 26 +++++++++++++------------- gb.pdf/src/CPdfDocument.h | 18 +++++++++--------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/gb.pdf/src/CPdfDocument.cpp b/gb.pdf/src/CPdfDocument.cpp index 80d2d97c5..bc3f7e24b 100644 --- a/gb.pdf/src/CPdfDocument.cpp +++ b/gb.pdf/src/CPdfDocument.cpp @@ -99,7 +99,7 @@ END_PROPERTY ****************************************************************************/ -static void return_unicode_string(Unicode *unicode, int len) +static void return_unicode_string(const Unicode *unicode, int len) { static UnicodeMap *uMap = NULL; @@ -128,7 +128,7 @@ static void aux_return_string_info(void *_object, const char *key) { Object obj; Object dst; - GooString *goo_value; + const GooString *goo_value; Dict *info_dict; char *tmpstr; @@ -170,7 +170,7 @@ static void aux_return_date_info(void *_object, const char *key) GB_DATE ret; Object obj; Object dst; - GooString *goo; + const GooString *goo; Dict *info_dict; char *datestr=NULL,*tofree=NULL; int nnum; @@ -221,7 +221,7 @@ static void aux_return_date_info(void *_object, const char *key) #endif } -static LinkDest *get_dest(LinkAction *act) +static const LinkDest *get_dest(const LinkAction *act) { if (!act) return 0; @@ -234,12 +234,12 @@ static LinkDest *get_dest(LinkAction *act) } } -static uint32_t aux_get_page_from_action(void *_object, LinkAction *act) +static uint32_t aux_get_page_from_action(void *_object, const LinkAction *act) { Ref pref; - LinkDest *dest = get_dest(act); + const LinkDest *dest = get_dest(act); #if POPPLER_VERSION_0_6 - GooString *name; + const GooString *name; #else UGooString *name; #endif @@ -270,9 +270,9 @@ static uint32_t aux_get_page_from_action(void *_object, LinkAction *act) } -static void aux_get_dimensions_from_action(LinkAction *act, CPDFRECT *rect) +static void aux_get_dimensions_from_action(const LinkAction *act, CPDFRECT *rect) { - LinkDest *dest = get_dest(act); + const LinkDest *dest = get_dest(act); if (!dest) return; @@ -282,20 +282,20 @@ static void aux_get_dimensions_from_action(LinkAction *act, CPDFRECT *rect) rect->h = dest->getBottom() - rect->y; } -static double aux_get_zoom_from_action(LinkAction *act) +static double aux_get_zoom_from_action(const LinkAction *act) { - LinkDest *dest = get_dest(act); + const LinkDest *dest = get_dest(act); if (dest) return dest->getZoom(); else return 1; } -static char* aux_get_target_from_action(LinkAction *act) +static char* aux_get_target_from_action(const LinkAction *act) { char *vl=NULL; char *uni=NULL; - GooString *tmp=NULL; + const GooString *tmp=NULL; switch (act->getKind()) { diff --git a/gb.pdf/src/CPdfDocument.h b/gb.pdf/src/CPdfDocument.h index d45c68203..14a6dc3d4 100644 --- a/gb.pdf/src/CPdfDocument.h +++ b/gb.pdf/src/CPdfDocument.h @@ -79,18 +79,18 @@ typedef SplashOutputDev *dev; Page *page; uint currpage; - - void **pindex; // Parent of current index entries - GooList *index; // Current entries - uint currindex; // Current entry - uint *oldindex; // Parent entry - Links *links; // Page bookmarks - uint lcurrent; // Current bookmark + void **pindex; // Parent of current index entries + const GooList *index; // Current entries + uint currindex; // Current entry + uint *oldindex; // Parent entry - CPDFFIND *Found; // Found text elements + Links *links; // Page bookmarks + uint lcurrent; // Current bookmark - LinkAction *action; // Current link action + CPDFFIND *Found; // Found text elements + + const LinkAction *action; // Current link action double scale; int rotation; From 6c9f64666aa84289cb0c6750ac81729c537f7836 Mon Sep 17 00:00:00 2001 From: Adrien Prokopowicz Date: Wed, 16 May 2018 01:43:21 +0200 Subject: [PATCH 2/8] [GB.XML] * BUG: Fix the XmlNode.GetElementsByAttributeValue() method. --- gb.xml/src/node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gb.xml/src/node.cpp b/gb.xml/src/node.cpp index bd0d61975..f53b82d22 100644 --- a/gb.xml/src/node.cpp +++ b/gb.xml/src/node.cpp @@ -340,7 +340,7 @@ void XMLNode_addGBChildrenByAttributeValue(Node *node, const char *attrName, con for(Node *tNode = node->firstChild; tNode != 0; tNode = tNode->nextNode) { if(tNode->type != Node::ElementNode) continue; - Attribute *attr = XMLElement_GetAttribute((Element*)node, attrName, lenAttrName); + Attribute *attr = XMLElement_GetAttribute((Element*)tNode, attrName, lenAttrName); if(attr) { if(GB_MatchString(attr->attrValue, attr->lenAttrValue, attrValue, lenAttrValue, mode)) From 0893ca7dee43994ce5f3e7063c125bd50f73f3b2 Mon Sep 17 00:00:00 2001 From: Tobias Boege Date: Wed, 16 May 2018 02:04:47 +0200 Subject: [PATCH 3/8] gb.pdf: Fix compilation with older popplers [GB.PDF] * BUG: Fix compilation with older popplers --- gb.pdf/configure.ac | 2 ++ gb.pdf/src/CPdfDocument.cpp | 9 ++++++++- gb.pdf/src/CPdfDocument.h | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gb.pdf/configure.ac b/gb.pdf/configure.ac index be4bf9557..765007707 100644 --- a/gb.pdf/configure.ac +++ b/gb.pdf/configure.ac @@ -31,6 +31,8 @@ if test "$have_poppler" = "yes"; then AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_20, $((1-$?)), Poppler version >= 0.20) pkg-config --atleast-version=0.58.0 poppler AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_58, $((1-$?)), Poppler version >= 0.58) + pkg-config --atleast-version=0.64.0 poppler + AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_64, $((1-$?)), Poppler version >= 0.64) fi AC_OUTPUT( \ diff --git a/gb.pdf/src/CPdfDocument.cpp b/gb.pdf/src/CPdfDocument.cpp index bc3f7e24b..6d068abfe 100644 --- a/gb.pdf/src/CPdfDocument.cpp +++ b/gb.pdf/src/CPdfDocument.cpp @@ -252,8 +252,15 @@ static uint32_t aux_get_page_from_action(void *_object, const LinkAction *act) if (act->getKind () == actionGoTo) { name = ((LinkGoTo*)act)->getNamedDest(); - if (name) + if (name) { + #if POPPLER_VERSION_0_64 dest = THIS->doc->findDest(name); + #elif POPPLER_VERSION_0_6 + dest = THIS->doc->findDest((GooString *) name); + #else + dest = THIS->doc->findDest((UGooString *) name); + #endif + } } } diff --git a/gb.pdf/src/CPdfDocument.h b/gb.pdf/src/CPdfDocument.h index 14a6dc3d4..e70a6b193 100644 --- a/gb.pdf/src/CPdfDocument.h +++ b/gb.pdf/src/CPdfDocument.h @@ -81,7 +81,11 @@ typedef uint currpage; void **pindex; // Parent of current index entries +#if POPPLER_VERSION_0_64 const GooList *index; // Current entries +#else /* <= 0.64 */ + GooList *index; // Current entries +#endif uint currindex; // Current entry uint *oldindex; // Parent entry @@ -90,7 +94,11 @@ typedef CPDFFIND *Found; // Found text elements +#if POPPLER_VERSION_0_64 const LinkAction *action; // Current link action +#else /* <= 0.64 */ + LinkAction *action; // Current link action +#endif double scale; int rotation; From e528f3441a96d727ec6ff7b72ee8220e243ca4d1 Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 16 May 2018 02:24:20 +0200 Subject: [PATCH 4/8] Fix compilation with poppler < 0.64. [GB.PDF] * BUG: Fix compilation with poppler < 0.64. --- gb.pdf/src/CPdfDocument.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/gb.pdf/src/CPdfDocument.cpp b/gb.pdf/src/CPdfDocument.cpp index 6d068abfe..5238e21d9 100644 --- a/gb.pdf/src/CPdfDocument.cpp +++ b/gb.pdf/src/CPdfDocument.cpp @@ -48,6 +48,14 @@ #include +#if POPPLER_VERSION_0_64 +#define const_LinkAction const LinkAction +#define const_LinkDest const LinkDest +#else +#define const_LinkAction LinkAction +#define const_LinkDest LinkDest +#endif + /***************************************************************************/ static CPDFRECT *create_rect(void) @@ -221,7 +229,7 @@ static void aux_return_date_info(void *_object, const char *key) #endif } -static const LinkDest *get_dest(const LinkAction *act) +static const_LinkDest *get_dest(const_LinkAction *act) { if (!act) return 0; @@ -234,10 +242,10 @@ static const LinkDest *get_dest(const LinkAction *act) } } -static uint32_t aux_get_page_from_action(void *_object, const LinkAction *act) +static uint32_t aux_get_page_from_action(void *_object, const_LinkAction *act) { Ref pref; - const LinkDest *dest = get_dest(act); + const_LinkDest *dest = get_dest(act); #if POPPLER_VERSION_0_6 const GooString *name; #else @@ -277,9 +285,9 @@ static uint32_t aux_get_page_from_action(void *_object, const LinkAction *act) } -static void aux_get_dimensions_from_action(const LinkAction *act, CPDFRECT *rect) +static void aux_get_dimensions_from_action(const_LinkAction *act, CPDFRECT *rect) { - const LinkDest *dest = get_dest(act); + const_LinkDest *dest = get_dest(act); if (!dest) return; @@ -289,16 +297,16 @@ static void aux_get_dimensions_from_action(const LinkAction *act, CPDFRECT *rect rect->h = dest->getBottom() - rect->y; } -static double aux_get_zoom_from_action(const LinkAction *act) +static double aux_get_zoom_from_action(const_LinkAction *act) { - const LinkDest *dest = get_dest(act); + const_LinkDest *dest = get_dest(act); if (dest) return dest->getZoom(); else return 1; } -static char* aux_get_target_from_action(const LinkAction *act) +static char* aux_get_target_from_action(const_LinkAction *act) { char *vl=NULL; char *uni=NULL; From f87cd1025b40791f2e77862d2491016f2172f859 Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 16 May 2018 02:29:12 +0200 Subject: [PATCH 5/8] Continue fixing compilation on old popplers. [GB.PDF] * BUG: Continue fixing compilation on old popplers. --- gb.pdf/src/CPdfDocument.cpp | 8 -------- gb.pdf/src/CPdfDocument.h | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/gb.pdf/src/CPdfDocument.cpp b/gb.pdf/src/CPdfDocument.cpp index 5238e21d9..4cd7eab3d 100644 --- a/gb.pdf/src/CPdfDocument.cpp +++ b/gb.pdf/src/CPdfDocument.cpp @@ -48,14 +48,6 @@ #include -#if POPPLER_VERSION_0_64 -#define const_LinkAction const LinkAction -#define const_LinkDest const LinkDest -#else -#define const_LinkAction LinkAction -#define const_LinkDest LinkDest -#endif - /***************************************************************************/ static CPDFRECT *create_rect(void) diff --git a/gb.pdf/src/CPdfDocument.h b/gb.pdf/src/CPdfDocument.h index e70a6b193..677ea01c1 100644 --- a/gb.pdf/src/CPdfDocument.h +++ b/gb.pdf/src/CPdfDocument.h @@ -32,6 +32,16 @@ #include #include +#if POPPLER_VERSION_0_64 +#define const_LinkAction const LinkAction +#define const_LinkDest const LinkDest +#define const_GooList const GooList +#else +#define const_LinkAction LinkAction +#define const_LinkDest LinkDest +#define const_GooList GooList +#endif + #ifndef __CPDFDOCUMENT_C extern GB_DESC PdfRectDesc[]; @@ -81,11 +91,8 @@ typedef uint currpage; void **pindex; // Parent of current index entries -#if POPPLER_VERSION_0_64 - const GooList *index; // Current entries -#else /* <= 0.64 */ - GooList *index; // Current entries -#endif + const_GooList *index; // Current entries + uint currindex; // Current entry uint *oldindex; // Parent entry @@ -94,11 +101,7 @@ typedef CPDFFIND *Found; // Found text elements -#if POPPLER_VERSION_0_64 - const LinkAction *action; // Current link action -#else /* <= 0.64 */ - LinkAction *action; // Current link action -#endif + const_LinkAction *action; // Current link action double scale; int rotation; From 64f20f041fb47a91997220d6188028f32a59e5bb Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 16 May 2018 03:50:46 +0200 Subject: [PATCH 6/8] Continue fixing compilation on old versions of the horrible poppler library. [GB.PDF] * BUG: Continue fixing compilation on old versions of the horrible poppler library. --- gb.pdf/src/CPdfDocument.cpp | 8 ++++---- gb.pdf/src/CPdfDocument.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gb.pdf/src/CPdfDocument.cpp b/gb.pdf/src/CPdfDocument.cpp index 4cd7eab3d..291a6f416 100644 --- a/gb.pdf/src/CPdfDocument.cpp +++ b/gb.pdf/src/CPdfDocument.cpp @@ -128,7 +128,7 @@ static void aux_return_string_info(void *_object, const char *key) { Object obj; Object dst; - const GooString *goo_value; + const_GooString *goo_value; Dict *info_dict; char *tmpstr; @@ -170,7 +170,7 @@ static void aux_return_date_info(void *_object, const char *key) GB_DATE ret; Object obj; Object dst; - const GooString *goo; + const_GooString *goo; Dict *info_dict; char *datestr=NULL,*tofree=NULL; int nnum; @@ -239,7 +239,7 @@ static uint32_t aux_get_page_from_action(void *_object, const_LinkAction *act) Ref pref; const_LinkDest *dest = get_dest(act); #if POPPLER_VERSION_0_6 - const GooString *name; + const_GooString *name; #else UGooString *name; #endif @@ -302,7 +302,7 @@ static char* aux_get_target_from_action(const_LinkAction *act) { char *vl=NULL; char *uni=NULL; - const GooString *tmp=NULL; + const_GooString *tmp=NULL; switch (act->getKind()) { diff --git a/gb.pdf/src/CPdfDocument.h b/gb.pdf/src/CPdfDocument.h index 677ea01c1..fa80d47a9 100644 --- a/gb.pdf/src/CPdfDocument.h +++ b/gb.pdf/src/CPdfDocument.h @@ -36,10 +36,12 @@ #define const_LinkAction const LinkAction #define const_LinkDest const LinkDest #define const_GooList const GooList +#define const_GooString const GooString #else #define const_LinkAction LinkAction #define const_LinkDest LinkDest #define const_GooList GooList +#define const_GooString GooString #endif #ifndef __CPDFDOCUMENT_C From e9bc65686cd5814a171f5fce1c842aa127434f69 Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 16 May 2018 19:00:22 +0200 Subject: [PATCH 7/8] Software farm: Don't crash when installing an example if its symbolic link alread exists. [DEVELOPMENT ENVIRONMENT] * BUG: Software farm: Don't crash when installing an example if its symbolic link alread exists. * BUG: Project tree: CTRL + double-click is now triggered only on source files. --- app/src/gambas3/.src/FMain.class | 6 ++++-- app/src/gambas3/.src/Project/Farm/CSoftware.class | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/gambas3/.src/FMain.class b/app/src/gambas3/.src/FMain.class index 722af9b16..a9c25665b 100644 --- a/app/src/gambas3/.src/FMain.class +++ b/app/src/gambas3/.src/FMain.class @@ -146,6 +146,7 @@ Public Sub tvwProject_Activate() Dim sMime As String Dim hProgList As DesktopFile[] Dim hProcess As Process + Dim sKeyClass As String sKey = tvwProject.Key @@ -153,8 +154,9 @@ Public Sub tvwProject_Activate() tvwProject[sKey].Expanded = True If CanEdit(sKey) Then If $bCtrl Then - If File.Ext(sKey) <> "module" Then - sKey = File.SetExt(sKey, "class") + If Project.IsSourcePath(sKey) And If File.Ext(sKey) <> "module" Then + sKeyClass = File.SetExt(sKey, "class") + If Project.IsSourcePath(sKeyClass) Then sKey = sKeyClass Endif Endif Project.OpenFile(sKey,,, True) diff --git a/app/src/gambas3/.src/Project/Farm/CSoftware.class b/app/src/gambas3/.src/Project/Farm/CSoftware.class index abc0493c9..2e1840bae 100644 --- a/app/src/gambas3/.src/Project/Farm/CSoftware.class +++ b/app/src/gambas3/.src/Project/Farm/CSoftware.class @@ -442,6 +442,7 @@ Public Sub Install(Optional bJustDownload As Boolean) As String If LCase(Vendor) <> "example" And If Tags.Exist("example", gb.IgnoreCase) Then Try Mkdir File.SetName(sSrcDir, "example") + Try Kill File.SetName(sSrcDir, "example") &/ sName Link ".." &/ File.Name(sSrcDir) &/ sName To File.SetName(sSrcDir, "example") &/ sName Endif From 82006001687cd957c0375b05e0dbcd3f0e14048b Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 16 May 2018 19:07:50 +0200 Subject: [PATCH 8/8] Don't crash when opening a Gambas source file as an external file. [DEVELOPMENT ENVIRONMENT] * BUG: Don't crash when opening a Gambas source file as an external file. --- app/src/gambas3/.src/Debug/Design.module | 2 ++ app/src/gambas3/.src/Editor/Code/FEditor.class | 3 +++ 2 files changed, 5 insertions(+) diff --git a/app/src/gambas3/.src/Debug/Design.module b/app/src/gambas3/.src/Debug/Design.module index 5ace48b5f..2ce6a0e32 100644 --- a/app/src/gambas3/.src/Debug/Design.module +++ b/app/src/gambas3/.src/Debug/Design.module @@ -1371,6 +1371,8 @@ Public Sub InitEditorWithBreakpoints(hEditor As FEditor) Dim I As Integer Dim sPrefix As String + If Project.IsFake() Then Return + sPrefix = hEditor.Name & "." While I < $aBreakpoint.Count sBreakpoint = $aBreakpoint[I] diff --git a/app/src/gambas3/.src/Editor/Code/FEditor.class b/app/src/gambas3/.src/Editor/Code/FEditor.class index a65029df2..c652b4fa7 100644 --- a/app/src/gambas3/.src/Editor/Code/FEditor.class +++ b/app/src/gambas3/.src/Editor/Code/FEditor.class @@ -1041,6 +1041,7 @@ Public Function CanSetBreakpoint(iLine As Integer) As Boolean Dim sLine As String Dim iPos As Integer + If Project.IsFake() Then Return If iLine < 0 Or If iLine >= $hEditor.Count Then Return '$hEditor[iLine].Refresh @@ -1082,6 +1083,7 @@ Public Sub CheckBreakpoints() Dim iLine As Integer + If Project.IsFake() Then Return For Each iLine In $hEditor.Breakpoints If Not CanSetBreakpoint(iLine) Then SetBreakpoint(iLine, False, False) Next @@ -3350,6 +3352,7 @@ End Public Sub mnuBreakpoint_Click() + If Not CanSetBreakpoint($hEditor.Line) Then Return Design.SetBreakpoint(Me.Name & "." & CStr($hEditor.Line), Not HasBreakpoint($hEditor.Line)) End