Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Moviga Technologies
 

Wow, thank you! 

Benoît! Can you include this in the SVN? Pretty please?! :) 
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] TextEdit on Qt5

2016-01-23 Thread Ian Haywood
This was a lot simpler than I thought.
I enclose a working patch. Two outstanding issues:
- the TextEdit has a grey background (the system default) and ignores
setting .Background = Color.White
- the documentation doesn't appear in the IDE (because it's looking
for qt4.TextEdit, whereas the docs wil lbe under
qt5.ext.TextEdit)

I suspect I'm missing something (i.e. if it's so easy presumably
Benoit had a good reason for not doing it at the start)
Anyway I hope this will kick the work along... as I said several of us
*really need* TextEdit!

Ian
diff --git a/gb.qt4/src/main.cpp b/gb.qt4/src/main.cpp
index 543dc7c..b3bfec6 100644
--- a/gb.qt4/src/main.cpp
+++ b/gb.qt4/src/main.cpp
@@ -99,6 +99,8 @@
 #include 
 #ifndef QT5
 #include "CEmbedder.h"
+#else
+#include "CTextEdit.h"
 #endif
 
 #include "desktop.h"
@@ -147,6 +149,9 @@ GB_CLASS CLASS_ScrollView;
 GB_CLASS CLASS_Image;
 GB_CLASS CLASS_SvgImage;
 GB_CLASS CLASS_TextArea;
+#ifdef QT5
+GB_CLASS CLASS_TextEdit;
+#endif
 
 static bool in_event_loop = false;
 static int _no_destroy = 0;
@@ -1298,6 +1303,9 @@ GB_DESC *GB_CLASSES[] EXPORT =
CWatcherDesc,
PrinterDesc,
SvgImageDesc,
+#ifdef QT5
+   CTextEditSelectionDesc, CTextEditFormatDesc, CTextEditDesc,
+#endif
NULL
 };
 
@@ -1406,7 +1414,9 @@ int EXPORT GB_INIT(void)
CLASS_Image = GB.FindClass("Image");
CLASS_SvgImage = GB.FindClass("SvgImage");
CLASS_TextArea = GB.FindClass("TextArea");
-
+#ifdef QT5
+   CLASS_TextEdit = GB.FindClass("TextEdit");
+#endif
QT_InitEventLoop();
 
#ifdef OS_CYGWIN
diff --git a/gb.qt5/src/CTextEdit.cpp b/gb.qt5/src/CTextEdit.cpp
new file mode 100644
index 000..bb0bc20
--- /dev/null
+++ b/gb.qt5/src/CTextEdit.cpp
@@ -0,0 +1,728 @@
+/***
+
+  CTextEdit.cpp
+
+  (c) 2000-2013 Benoît Minisini 
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2, or (at your option)
+  any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+  MA 02110-1301, USA.
+
+***/
+
+#define __CTEXTEDIT_CPP
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+ 
+#include "gambas.h"
+#include "main.h"
+#include "CFont.h"
+#include "CConst.h"
+#include "CTextEdit.h"
+
+
+DECLARE_EVENT(EVENT_Change);
+DECLARE_EVENT(EVENT_Cursor);
+
+#if 0
+static void to_pos(Q3TextEdit *wid, int par, int car, int *pos)
+{
+  int i, l;
+  int p = 0;
+
+  for (i = 0; i < par; i++)
+  {
+l = wid->paragraphLength(i);
+if (l < 0)
+  break;
+p += l + 1;
+  }
+
+  *pos = p + car;
+}
+
+
+static void from_pos(Q3TextEdit *wid, int pos, int *par, int *car)
+{
+  int i;
+  int l;
+
+  for (i = 0; i <= wid->paragraphs(); i++)
+  {
+l = wid->paragraphLength(i);
+if (l < 0)
+{
+  pos = wid->length();
+  i--;
+  break;
+}
+if (pos <= l)
+  break;
+pos -= l + 1;
+  }
+
+  *par = i;
+  *car = pos;
+}
+
+
+static void look_pos(Q3TextEdit *wid, int *line, int *col)
+{
+  if (*line == -1)
+*line = wid->paragraphs();
+
+  if (*col == -1)
+*col = wid->paragraphLength(*line);
+}
+
+
+static void get_selection(Q3TextEdit *wid, int *start, int *length)
+{
+  int pStart, iStart, pEnd, iEnd;
+  int posEnd;
+
+  wid->getSelection(, , , );
+
+  if (pStart < 0)
+  {
+wid->getCursorPosition(, );
+to_pos(wid, pStart, iStart, start);
+*length = 0;
+return;
+  }
+
+  to_pos(wid, pStart, iStart, start);
+  to_pos(wid, pEnd, iEnd, );
+
+  *length = posEnd - *start;
+}
+#endif
+
+static int get_length(void *_object)
+{
+   if (THIS->length < 0)
+   {
+   QTextBlock block = WIDGET->document()->begin();
+   int len = 0;
+   
+   while (block.isValid())
+   {
+   len += block.length();
+   block = block.next();
+   }
+
+   THIS->length = len - 1;
+   }
+   
+   return THIS->length;
+}
+
+static int get_column(void *_object)
+{
+   QTextCursor cursor = WIDGET->textCursor();
+   return cursor.position() - cursor.block().position();
+}
+
+static void to_pos(QTextEdit *wid, int par, int car, int *pos)
+{
+   QTextCursor cursor = wid->textCursor();
+   QTextBlock block = cursor.block();
+  int p = 0;
+
+  while (par)

Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Benoît Minisini
Le 23/01/2016 14:33, Moviga Technologies a écrit :
>
>
> Wow, thank you!
>
> Benoît! Can you include this in the SVN? Pretty please?! :)

Yes, but it cannot be included directly in the gb.qt5 component. It must 
be included in an extension component like gb.qt4 has.

-- 
Benoît Minisini

--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Moviga Technologies
 

That's very fine! 
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Debian problem step 3.5.4 to 3.8.4

2016-01-23 Thread Gianluigi
Hello Benoit,
Our mutual friend announces that, after setting the component gb.gui.qt,
now to several days after,  they have all  worked.
I apologize for the trouble, but I believe that you will be happy to know
that you have worked a miracle for induction, the projects rather than
submit to your harsh judgment, they have preferred self-adjust  :-)
I hope this good news help the friend Pino Zollo to review its decision.
:-D
Regards
Gianluigi

2016-01-21 2:51 GMT+01:00 Benoît Minisini :

> Le 21/01/2016 02:35, Ian Haywood a écrit :
> > On Tue, Jan 19, 2016 at 8:45 PM, Gianluigi  wrote:
> >> Hello to all,
> >> a friend of ours of Gambas-it forum, runs Debian and updated from
> version
> >> 3.5.4 to 3.8.4.
> >> He can no longer use the old qt4 projects.
> >> He tried compile, compile all, refresh, reload … but nothing.
> >> Changing with gb.gui.qt in some projects the Fmain.class disappears and
> in
> >> the other Fmain.form.
> >> On Update all forms he gets this message: “Unable to update all forms!
> Too
> >> many arguments. ProjectUpdateAllForms.5941”.
> >
> > Is he/she using TextEdit?
> >
> > This is the problem I have run into: Debian no longer supports Qt4,
> > and Qt5 on Gambas
> > has no TextEdit, so my project doesn't load.
> >
> > I would like to enter in another plea for TextEdit to be supported on
> Qt5.
> > Previous discussions have been around a Gambas-native rich text
> > editor: agree that's a
> > lot of work, but also unnecessary: Qt5 has a rich text editor (see
> > http://doc.qt.io/qt-5/richtext.html)
> > I don't see why that cannot be used.
> >
> > I'd have a crack at doing it myself but I have limited time and
> > haven't used C++/Qt for many years
> > so it would take some time to relearn.
> > Would be happy to pay if there are others able to here.
> >
> > ian
> >
>
> Indeed. Normally switching from Qt4 to Qt5 has no big problem unless you
> use the TextEdit control. Does your friend use it? Otherwise, can you
> send one or two projects that do not work?
>
> --
> Benoît Minisini
>
>
> --
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Benoît Minisini
Le 23/01/2016 09:48, Ian Haywood a écrit :
> This was a lot simpler than I thought.
> I enclose a working patch. Two outstanding issues:
> - the TextEdit has a grey background (the system default) and ignores
> setting .Background = Color.White
> - the documentation doesn't appear in the IDE (because it's looking
> for qt4.TextEdit, whereas the docs wil lbe under
> qt5.ext.TextEdit)
>
> I suspect I'm missing something (i.e. if it's so easy presumably
> Benoit had a good reason for not doing it at the start)
> Anyway I hope this will kick the work along... as I said several of us
> *really need* TextEdit!
>
> Ian
>

TextEdit has been included in a new 'gb.qt5.ext' component in revision 
#7584.

I hope you will make a statue of me. :-)

Note that there is no 'gb.gui.qt.ext' virtual component to automatically 
switch between gb.qt4.ext and gb.qt5.ext, as these two components do not 
include the same controls.

Regards,

-- 
Benoît Minisini

--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Benoît Minisini
Le 24/01/2016 01:25, Moviga Technologies a écrit :
>
>
> That is super! I'll give you a cyber man hug as I am not to good with a
> chisel :)
>
>

I'm normally going to Geneva Feb., 4th on the evening, if you want to 
bring me some swiss chocolate. :-)

-- 
Benoît Minisini

--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Moviga Technologies
 

It took me half a minute to understand what you mean :) I am using the
Kolab mail service as it has great terms, but I am in fact Norwegian :)
We have some really good milk chocolate here too though. I can send you
some as a thank you if you for the component, and Gambas in general, if
you email me your address. 
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Benoît Minisini
Le 24/01/2016 02:18, Moviga Technologies a écrit :
>
>
> Making all in ext
> make[5]: Entering directory
> '/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5/src/ext'
>   CXX  gb_qt5_ext_la-main.lo
> /usr/lib/qt/bin/moc -o CTextEdit_moc.cpp CTextEdit.h
>   CXX  gb_qt5_ext_la-CTextEdit_moc.lo
>   CXX  gb_qt5_ext_la-CTextEdit.lo
>   CXXLDgb.qt5.ext.la
> make[5]: *** No rule to make target 'gb.qt5.ext.component', needed by
> 'all-am'.  Stop.
> make[5]: Leaving directory
> '/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5/src/ext'
> Makefile:1330: recipe for target 'all-recursive' failed
> make[4]: *** [all-recursive] Error 1
> make[4]: Leaving directory
> '/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5/src'
> Makefile:448: recipe for target 'all-recursive' failed
> make[3]: *** [all-recursive] Error 1
> make[3]: Leaving directory
> '/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5'
> Makefile:380: recipe for target 'all' failed
> make[2]: *** [all] Error 2
> make[2]: Leaving directory
> '/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5'
> Makefile:438: recipe for target 'all-recursive' failed
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory
> '/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk'
> Makefile:379: recipe for target 'all' failed
> make: *** [all] Error 2
>
>

Oops, fixed in revision #7585.

-- 
Benoît Minisini

--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Moviga Technologies
 

Making all in ext 
make[5]: Entering directory
'/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5/src/ext' 
 CXX  gb_qt5_ext_la-main.lo 
/usr/lib/qt/bin/moc -o CTextEdit_moc.cpp CTextEdit.h 
 CXX  gb_qt5_ext_la-CTextEdit_moc.lo 
 CXX  gb_qt5_ext_la-CTextEdit.lo 
 CXXLDgb.qt5.ext.la 
make[5]: *** No rule to make target 'gb.qt5.ext.component', needed by
'all-am'.  Stop. 
make[5]: Leaving directory
'/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5/src/ext' 
Makefile:1330: recipe for target 'all-recursive' failed 
make[4]: *** [all-recursive] Error 1 
make[4]: Leaving directory
'/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5/src' 
Makefile:448: recipe for target 'all-recursive' failed 
make[3]: *** [all-recursive] Error 1 
make[3]: Leaving directory
'/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5' 
Makefile:380: recipe for target 'all' failed 
make[2]: *** [all] Error 2 
make[2]: Leaving directory
'/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk/gb.qt5' 
Makefile:438: recipe for target 'all-recursive' failed 
make[1]: *** [all-recursive] Error 1 
make[1]: Leaving directory
'/home/jornmo/Sync/Gambaspakker/Gambas-SVN/src/trunk' 
Makefile:379: recipe for target 'all' failed 
make: *** [all] Error 2

  
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Moviga Technologies
 

That is super! I'll give you a cyber man hug as I am not to good with a
chisel :) 

  
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] TextEdit on Qt5

2016-01-23 Thread Benoît Minisini
Le 24/01/2016 01:40, Moviga Technologies a écrit :
>
>
> It took me half a minute to understand what you mean :) I am using the
> Kolab mail service as it has great terms, but I am in fact Norwegian :)
> We have some really good milk chocolate here too though. I can send you
> some as a thank you if you for the component, and Gambas in general, if
> you email me your address.

H okay ! Maybe you can finish the translation of the IDE in 
norwegian instead ? And the components ? :-)

-- 
Benoît Minisini

--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user