lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [PATCH] Don't hard code explicit wxDatePickerCtrl size


From: Vadim Zeitlin
Subject: Re: [lmi] [PATCH] Don't hard code explicit wxDatePickerCtrl size
Date: Tue, 3 Feb 2015 22:44:38 +0100

On Sun, 01 Feb 2015 16:23:19 +0000 Greg Chicares <address@hidden> wrote:

GC> On 02/01/2015 11:07 AM, Vadim Zeitlin wrote:
GC> > On Sat, 31 Jan 2015 19:52:25 +0000 Greg Chicares <address@hidden> wrote:
GC> [...]
GC> > GC> 
GC> > GC> /opt/lmi/build[0]$LC_TIME="en_DK" 
LD_LIBRARY_PATH=/usr/local/lib:/opt/lmi/local/lib ./lmi_wx --ash_nazg
GC> > GC> locale::facet::_S_create_c_locale name not valid
GC> > GC> 
GC> > GC> That would appear to be a libstdc++ issue.
GC> > 
GC> >  I think it's a Boost.Filesystem one, see 
https://svn.boost.org/trac/boost/ticket/4688
GC> 
GC> Wow.

 The good thing is that by the time lmi will upgrade to a newer boost
version, this bug will almost assuredly have been fixed in it ;-)

GC> It's "02/01/2015" whether or not I override LC_TIME on the command line.

 This is not really surprising because lmi doesn't honour the current
locale. To make this work you could simply do
---------------------------------- >8 --------------------------------------
diff --git a/main_wx.cpp b/main_wx.cpp
index 0a7d940..19c6e29 100644
--- a/main_wx.cpp
+++ b/main_wx.cpp
@@ -92,6 +92,7 @@ int main(int argc, char* argv[])
         {
         initialize_application();
         initialize_filesystem();
+        setlocale(LC_TIME, "");
 #ifndef LMI_MSW
         result = wxEntry(argc, argv);
 #else // LMI_MSW defined.
---------------------------------- >8 --------------------------------------

A better solution would be to create a wxLocale with wxLANGUAGE_DEFAULT, as
this would also work under MSW. However this is not as selective and would
be the equivalent of setlocale(LC_ALL), which may be problematic as lmi
code supposes that the decimal separator is always period and not comma,
resulting in errors (which, to rejoin the parallel thread, are only shown
in the terminal currently) such as

Attempt to convert string '0.06' from type std::string to type double failed on 
terminal substring '.06'.

and failing to create a new illustration, for example.


GC> > GC> > GC> Anyway, there are many other issues:
GC> > GC> > GC>  - Numeric textcontrols on "Inforce" tab (e.g.) are not wide 
enough.
GC> > GC> > 
GC> > GC> >  This is almost certainly due to hardcoding their width to 80 
pixels.
GC> > GC> 
GC> > GC> Yes, of course. That's under my control. I just won't have the time to
GC> > GC> address all of this soon: doing it carefully takes a lot of work.
GC> > 
GC> >  Should I try to propose a patch fixing this?
GC> 
GC> Sure, subject to:
GC>  - With 'skin.xrc' at least, the tabbed dialog should fit on the screen even
GC>    at 800x600 resolution (it's about 735x544 already).

 This is going to be difficult :-( I think 800x600 is really too
conservative, the smallest desktop screen resolution that appears in a
couple of web views statistics gathering sites is 1024*768 and it's only
used by ~5% of people. 1366*768 remains depressingly common, but 800*600
just doesn't seem to exist any more, statistically speaking.

GC> Here are all the warnings I see--all for deprecated gtk stuff:
GC> 
GC> /opt/lmi/wxWidgets/src/gtk/fontdlg.cpp:45:30: warning: ‘gchar* 
gtk_font_selection_dialog_get_font_name(GtkFontSelectionDialog*)’ is deprecated 
(declared at /usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:151): Use 
'GtkFontChooser' instead [-Wdeprecated-declarations]
GC> /opt/lmi/wxWidgets/src/gtk/fontdlg.cpp:45:73: warning: ‘gchar* 
gtk_font_selection_dialog_get_font_name(GtkFontSelectionDialog*)’ is deprecated 
(declared at /usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:151): Use 
'GtkFontChooser' instead [-Wdeprecated-declarations]
GC> /opt/lmi/wxWidgets/src/gtk/fontdlg.cpp:86:20: warning: ‘GtkWidget* 
gtk_font_selection_dialog_new(const gchar*)’ is deprecated (declared at 
/usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:142): Use 'GtkFontChooser' 
instead [-Wdeprecated-declarations]
GC> /opt/lmi/wxWidgets/src/gtk/fontdlg.cpp:86:69: warning: ‘GtkWidget* 
gtk_font_selection_dialog_new(const gchar*)’ is deprecated (declared at 
/usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:142): Use 'GtkFontChooser' 
instead [-Wdeprecated-declarations]
GC> /opt/lmi/wxWidgets/src/gtk/fontdlg.cpp:109:17: warning: ‘gboolean 
gtk_font_selection_dialog_set_font_name(GtkFontSelectionDialog*, const gchar*)’ 
is deprecated (declared at 
/usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:153): Use 'GtkFontChooser' 
instead [-Wdeprecated-declarations]
GC> /opt/lmi/wxWidgets/src/gtk/fontdlg.cpp:109:82: warning: ‘gboolean 
gtk_font_selection_dialog_set_font_name(GtkFontSelectionDialog*, const gchar*)’ 
is deprecated (declared at 
/usr/include/gtk-3.0/gtk/deprecated/gtkfontsel.h:153): Use 'GtkFontChooser' 
instead [-Wdeprecated-declarations]
GC> /opt/lmi/wxWidgets/src/gtk/dataview.cpp:3511:5: warning: ‘void 
gtk_widget_get_pointer(GtkWidget*, gint*, gint*)’ is deprecated (declared at 
/usr/include/gtk-3.0/gtk/gtkwidget.h:747): Use 'gdk_window_get_device_position' 
instead [-Wdeprecated-declarations]
GC> /opt/lmi/wxWidgets/src/gtk/dataview.cpp:3511:61: warning: ‘void 
gtk_widget_get_pointer(GtkWidget*, gint*, gint*)’ is deprecated (declared at 
/usr/include/gtk-3.0/gtk/gtkwidget.h:747): Use 'gdk_window_get_device_position' 
instead [-Wdeprecated-declarations]

 Yes, I get them too but they're not immediately obvious to fix, so I left
them alone.

GC> But compiling lmi fails:
GC> 
GC> In file included from /usr/include/gtk-2.0/gdk/gdkscreen.h:32:0,
GC>                  from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:31,
GC>                  from /usr/include/gtk-2.0/gdk/gdk.h:32,
GC>                  from /usr/include/gtk-2.0/gtk/gtk.h:32,
GC>                  from /opt/lmi/src/lmi/skeleton.cpp:113:
GC> /usr/include/gtk-2.0/gdk/gdktypes.h:114:39: error: conflicting declaration 
'typedef struct _GdkDrawable GdkWindow'
                 ^^^^^^^
 This file must not be included when using wxGTK3, but currently is due to
the hardcoded GTK+ 2 version in configure.ac. The simplest solution is to
not check for GTK+ at all in lmi configure, after all we should be using
portable wxWidgets API and not GTK+ at all. Unfortunately currently we do
use it in skeleton.cpp. The platform-specific code where it is used should
probably be removed entirely as support for this was added to wxWidgets a
long time ago, but for now the simplest possible patch that should allow
you to build with GTK+ 3 is
---------------------------------- >8 --------------------------------------
diff --git a/configure.ac b/configure.ac
index 4272016..608575d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -405,7 +405,6 @@ dnl system but when using MSYS we do the checks manually as 
installing
 dnl pkg-config under Windows is unfortunately not trivial and so we can't rely
 dnl on its presence on the target system
 if test "$USE_LINUX" = "1"; then
-    PKG_CHECK_MODULES(GTK, gtk+-2.0)
     PKG_CHECK_MODULES(XMLWRAPP, xmlwrapp >= 0.7.0 xsltwrapp)
 else
     if test -z "$XMLWRAPP_CFLAGS" -o -z "$XMLWRAPP_LIBS"; then
diff --git a/skeleton.cpp b/skeleton.cpp
index 8612c56..944567e 100644
--- a/skeleton.cpp
+++ b/skeleton.cpp
@@ -110,7 +110,7 @@
 #include <string>

 #if defined __WXGTK__
-#   include <gtk/gtk.h>
+    extern "C" void g_signal_emit_by_name(void*, const char*, ...);
 #endif

 // Where a builtin wxID_X identifier exists, use it as such, even if
---------------------------------- >8 --------------------------------------

 Please let me know if you still have any problems, thanks,
VZ

reply via email to

[Prev in Thread] Current Thread [Next in Thread]