image update
listbox fix iODBC fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1378 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -353,7 +353,7 @@ bool wxTable::query(int queryType, bool forUpdate, bool distinct, char *pSqlStmt
|
||||
// Make sure the cursor is closed first
|
||||
if (! CloseCursor(hstmt))
|
||||
return(FALSE);
|
||||
|
||||
|
||||
// Execute the SQL SELECT statement
|
||||
if (SQLExecDirect(hstmt, (UCHAR FAR *) (queryType == DB_SELECT_STATEMENT ? pSqlStmt : sqlStmt),
|
||||
SQL_NTS) != SQL_SUCCESS)
|
||||
@@ -667,10 +667,16 @@ bool wxTable::CreateTable(void)
|
||||
* (sqlstate = 42000) rather than an S0002. */
|
||||
|
||||
/* PostgreSQL 6.4.0 returns "08S01" or in written form
|
||||
"ERROR: Relation ... Does Not Exist, Robert Roebling */
|
||||
"ERROR: Relation ... Does Not Exist", Robert Roebling */
|
||||
|
||||
/* MySQL 3.23.33b returns "S1000" or in written form
|
||||
"ERROR: Unknown table ...", Robert Roebling */
|
||||
|
||||
/* This routine is bullshit, Robert Roebling */
|
||||
|
||||
pDb->GetNextError(henv, hdbc, hstmt);
|
||||
if (strcmp(pDb->sqlState, "S0002") &&
|
||||
strcmp(pDb->sqlState, "S1000") &&
|
||||
strcmp(pDb->sqlState, "42000") &&
|
||||
strcmp(pDb->sqlState, "08S01"))
|
||||
{
|
||||
@@ -753,6 +759,14 @@ bool wxTable::CreateTable(void)
|
||||
sprintf(s, "(%d)", colDefs[i].SzDataObj);
|
||||
strcat(sqlStmt, s);
|
||||
}
|
||||
|
||||
#ifdef __WXGTK__
|
||||
if (colDefs[i].KeyField)
|
||||
{
|
||||
strcat(sqlStmt, " NOT NULL");
|
||||
}
|
||||
#endif
|
||||
|
||||
needComma = TRUE;
|
||||
}
|
||||
// If there is a primary key defined, include it in the create statement
|
||||
@@ -766,9 +780,15 @@ bool wxTable::CreateTable(void)
|
||||
}
|
||||
if (j) // Found a keyfield
|
||||
{
|
||||
#ifndef __WXGTK__
|
||||
/* MySQL goes out on this one. We also declare the relevant key NON NULL above */
|
||||
strcat(sqlStmt, ",CONSTRAINT ");
|
||||
strcat(sqlStmt, tableName);
|
||||
strcat(sqlStmt, "_PIDX PRIMARY KEY (");
|
||||
#else
|
||||
strcat(sqlStmt, ", PRIMARY KEY (");
|
||||
#endif
|
||||
|
||||
// List column name(s) of column(s) comprising the primary key
|
||||
for (i = j = 0; i < noCols; i++)
|
||||
{
|
||||
@@ -782,8 +802,8 @@ bool wxTable::CreateTable(void)
|
||||
strcat(sqlStmt, ")");
|
||||
}
|
||||
// Append the closing parentheses for the create table statement
|
||||
strcat(sqlStmt, ")");
|
||||
|
||||
strcat(sqlStmt, ")");
|
||||
|
||||
pDb->WriteSqlLog(sqlStmt);
|
||||
|
||||
#ifdef _CONSOLE
|
||||
@@ -830,10 +850,15 @@ bool wxTable::CreateIndex(char * idxName, bool unique, int noIdxCols, CidxDef *p
|
||||
for (int i = 0; i < noIdxCols; i++)
|
||||
{
|
||||
strcat(sqlStmt, pIdxDefs[i].ColName);
|
||||
|
||||
/* Postgres doesnt cope with ASC */
|
||||
#ifndef __WXGTK__
|
||||
if (pIdxDefs[i].Ascending)
|
||||
strcat(sqlStmt, " ASC");
|
||||
else
|
||||
strcat(sqlStmt, " DESC");
|
||||
#endif
|
||||
|
||||
if ((i + 1) < noIdxCols)
|
||||
strcat(sqlStmt, ", ");
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/debug.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/app.h"
|
||||
#ifdef wxUSE_LIBPNG
|
||||
#include "../png/png.h"
|
||||
#endif
|
||||
@@ -1383,21 +1384,29 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
GdkColormap *cmap = gtk_widget_get_default_colormap();
|
||||
GdkColor *colors = cmap->colors;
|
||||
int max = 3 * (65536);
|
||||
int index = -1;
|
||||
int pixel = -1;
|
||||
if (wxTheApp->m_colorCube)
|
||||
{
|
||||
pixel = wxTheApp->m_colorCube
|
||||
[ ((r & 0xf8) << 7) + ((g & 0xf8) << 2) + ((b & 0xf8) >> 3) ];
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkColormap *cmap = gtk_widget_get_default_colormap();
|
||||
GdkColor *colors = cmap->colors;
|
||||
int max = 3 * (65536);
|
||||
|
||||
for (int i = 0; i < cmap->size; i++)
|
||||
{
|
||||
int rdiff = (r << 8) - colors[i].red;
|
||||
int gdiff = (g << 8) - colors[i].green;
|
||||
int bdiff = (b << 8) - colors[i].blue;
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { index = i; max = sum; }
|
||||
for (int i = 0; i < cmap->size; i++)
|
||||
{
|
||||
int rdiff = (r << 8) - colors[i].red;
|
||||
int gdiff = (g << 8) - colors[i].green;
|
||||
int bdiff = (b << 8) - colors[i].blue;
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { pixel = i; max = sum; }
|
||||
}
|
||||
}
|
||||
|
||||
gdk_image_put_pixel( data_image, x, y, index );
|
||||
gdk_image_put_pixel( data_image, x, y, pixel );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@@ -161,17 +161,23 @@ wxApp::wxApp()
|
||||
m_idleTag = 0;
|
||||
m_topWindow = (wxWindow *) NULL;
|
||||
m_exitOnFrameDelete = TRUE;
|
||||
m_colorCube = (unsigned char*) NULL;
|
||||
wxTheApp = this;
|
||||
}
|
||||
|
||||
wxApp::~wxApp(void)
|
||||
{
|
||||
gtk_idle_remove( m_idleTag );
|
||||
|
||||
if (m_colorCube) free(m_colorCube);
|
||||
}
|
||||
|
||||
bool wxApp::InitVisual()
|
||||
{
|
||||
return TRUE;
|
||||
/* Nothing to do for 15, 16, 24, 32 bit displays */
|
||||
|
||||
GdkVisual *visual = gdk_visual_get_system();
|
||||
if (visual->depth > 8) return TRUE;
|
||||
|
||||
/* this initiates the standard palette as defined by GdkImlib
|
||||
in the GNOME libraries. it ensures that all GNOME applications
|
||||
@@ -179,6 +185,7 @@ bool wxApp::InitVisual()
|
||||
can use several rather graphics-heavy applications at the
|
||||
same time */
|
||||
|
||||
/*
|
||||
GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE );
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
@@ -193,6 +200,41 @@ bool wxApp::InitVisual()
|
||||
}
|
||||
|
||||
gtk_widget_set_default_colormap( cmap );
|
||||
*/
|
||||
|
||||
/* initialize color cube for 8-bit color reduction dithering */
|
||||
|
||||
GdkColormap *cmap = gtk_widget_get_default_colormap();
|
||||
|
||||
m_colorCube = (unsigned char*)malloc(32 * 32 * 32);
|
||||
|
||||
for (int r = 0; r < 32; r++)
|
||||
{
|
||||
for (int g = 0; g < 32; g++)
|
||||
{
|
||||
for (int b = 0; b < 32; b++)
|
||||
{
|
||||
int rr = (r << 3) | (r >> 2);
|
||||
int gg = (g << 3) | (g >> 2);
|
||||
int bb = (b << 3) | (b >> 2);
|
||||
|
||||
GdkColor *colors = cmap->colors;
|
||||
int max = 3 * (65536);
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < cmap->size; i++)
|
||||
{
|
||||
int rdiff = ((rr << 8) - colors[i].red);
|
||||
int gdiff = ((gg << 8)- colors[i].green);
|
||||
int bdiff = ((bb << 8)- colors[i].blue);
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { index = i; max = sum; }
|
||||
}
|
||||
|
||||
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -169,26 +169,26 @@ void wxColour::CalcPixel( GdkColormap *cmap )
|
||||
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
|
||||
M_COLDATA->FreeColour();
|
||||
|
||||
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
|
||||
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
|
||||
(private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
|
||||
{
|
||||
GdkColor *colors = cmap->colors;
|
||||
int max = 3 * (65536);
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < cmap->size; i++)
|
||||
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
|
||||
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
|
||||
(private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
|
||||
{
|
||||
int rdiff = (M_COLDATA->m_color.red - colors[i].red);
|
||||
int gdiff = (M_COLDATA->m_color.green - colors[i].green);
|
||||
int bdiff = (M_COLDATA->m_color.blue - colors[i].blue);
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { index = i; max = sum; }
|
||||
}
|
||||
GdkColor *colors = cmap->colors;
|
||||
int max = 3 * (65536);
|
||||
int index = -1;
|
||||
|
||||
M_COLDATA->m_hasPixel = TRUE;
|
||||
M_COLDATA->m_color.pixel = index;
|
||||
}
|
||||
for (int i = 0; i < cmap->size; i++)
|
||||
{
|
||||
int rdiff = (M_COLDATA->m_color.red - colors[i].red);
|
||||
int gdiff = (M_COLDATA->m_color.green - colors[i].green);
|
||||
int bdiff = (M_COLDATA->m_color.blue - colors[i].blue);
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { index = i; max = sum; }
|
||||
}
|
||||
|
||||
M_COLDATA->m_hasPixel = TRUE;
|
||||
M_COLDATA->m_color.pixel = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
|
||||
|
@@ -239,13 +239,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
if (m_hasCheckBoxes)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"button_press_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
}
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"button_press_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"key_press_event",
|
||||
@@ -306,13 +303,10 @@ void wxListBox::AppendCommon( const wxString &item )
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
if (m_hasCheckBoxes)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"button_press_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
}
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"button_press_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"key_press_event",
|
||||
|
@@ -161,17 +161,23 @@ wxApp::wxApp()
|
||||
m_idleTag = 0;
|
||||
m_topWindow = (wxWindow *) NULL;
|
||||
m_exitOnFrameDelete = TRUE;
|
||||
m_colorCube = (unsigned char*) NULL;
|
||||
wxTheApp = this;
|
||||
}
|
||||
|
||||
wxApp::~wxApp(void)
|
||||
{
|
||||
gtk_idle_remove( m_idleTag );
|
||||
|
||||
if (m_colorCube) free(m_colorCube);
|
||||
}
|
||||
|
||||
bool wxApp::InitVisual()
|
||||
{
|
||||
return TRUE;
|
||||
/* Nothing to do for 15, 16, 24, 32 bit displays */
|
||||
|
||||
GdkVisual *visual = gdk_visual_get_system();
|
||||
if (visual->depth > 8) return TRUE;
|
||||
|
||||
/* this initiates the standard palette as defined by GdkImlib
|
||||
in the GNOME libraries. it ensures that all GNOME applications
|
||||
@@ -179,6 +185,7 @@ bool wxApp::InitVisual()
|
||||
can use several rather graphics-heavy applications at the
|
||||
same time */
|
||||
|
||||
/*
|
||||
GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE );
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
@@ -193,6 +200,41 @@ bool wxApp::InitVisual()
|
||||
}
|
||||
|
||||
gtk_widget_set_default_colormap( cmap );
|
||||
*/
|
||||
|
||||
/* initialize color cube for 8-bit color reduction dithering */
|
||||
|
||||
GdkColormap *cmap = gtk_widget_get_default_colormap();
|
||||
|
||||
m_colorCube = (unsigned char*)malloc(32 * 32 * 32);
|
||||
|
||||
for (int r = 0; r < 32; r++)
|
||||
{
|
||||
for (int g = 0; g < 32; g++)
|
||||
{
|
||||
for (int b = 0; b < 32; b++)
|
||||
{
|
||||
int rr = (r << 3) | (r >> 2);
|
||||
int gg = (g << 3) | (g >> 2);
|
||||
int bb = (b << 3) | (b >> 2);
|
||||
|
||||
GdkColor *colors = cmap->colors;
|
||||
int max = 3 * (65536);
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < cmap->size; i++)
|
||||
{
|
||||
int rdiff = ((rr << 8) - colors[i].red);
|
||||
int gdiff = ((gg << 8)- colors[i].green);
|
||||
int bdiff = ((bb << 8)- colors[i].blue);
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { index = i; max = sum; }
|
||||
}
|
||||
|
||||
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -169,26 +169,26 @@ void wxColour::CalcPixel( GdkColormap *cmap )
|
||||
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
|
||||
M_COLDATA->FreeColour();
|
||||
|
||||
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
|
||||
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
|
||||
(private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
|
||||
{
|
||||
GdkColor *colors = cmap->colors;
|
||||
int max = 3 * (65536);
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < cmap->size; i++)
|
||||
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
|
||||
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
|
||||
(private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
|
||||
{
|
||||
int rdiff = (M_COLDATA->m_color.red - colors[i].red);
|
||||
int gdiff = (M_COLDATA->m_color.green - colors[i].green);
|
||||
int bdiff = (M_COLDATA->m_color.blue - colors[i].blue);
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { index = i; max = sum; }
|
||||
}
|
||||
GdkColor *colors = cmap->colors;
|
||||
int max = 3 * (65536);
|
||||
int index = -1;
|
||||
|
||||
M_COLDATA->m_hasPixel = TRUE;
|
||||
M_COLDATA->m_color.pixel = index;
|
||||
}
|
||||
for (int i = 0; i < cmap->size; i++)
|
||||
{
|
||||
int rdiff = (M_COLDATA->m_color.red - colors[i].red);
|
||||
int gdiff = (M_COLDATA->m_color.green - colors[i].green);
|
||||
int bdiff = (M_COLDATA->m_color.blue - colors[i].blue);
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { index = i; max = sum; }
|
||||
}
|
||||
|
||||
M_COLDATA->m_hasPixel = TRUE;
|
||||
M_COLDATA->m_color.pixel = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
|
||||
|
@@ -239,13 +239,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
if (m_hasCheckBoxes)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"button_press_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
}
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"button_press_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"key_press_event",
|
||||
@@ -306,13 +303,10 @@ void wxListBox::AppendCommon( const wxString &item )
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
if (m_hasCheckBoxes)
|
||||
{
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"button_press_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
}
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"button_press_event",
|
||||
(GtkSignalFunc)gtk_listbox_button_press_callback,
|
||||
(gpointer) this );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item),
|
||||
"key_press_event",
|
||||
|
@@ -7,6 +7,8 @@
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#define NO_TRACE
|
||||
|
||||
# define TRACE_TYPE_APP2DM 1
|
||||
# define TRACE_TYPE_DM2DRV 2
|
||||
# define TRACE_TYPE_DRV2DM 3
|
||||
|
@@ -122,7 +122,7 @@ getinitfile(char* buf, int size)
|
||||
int i, j;
|
||||
char* ptr;
|
||||
|
||||
j = STRLEN("/odbc.ini") + 1;
|
||||
j = STRLEN("/iodbc.ini") + 1;
|
||||
|
||||
if( size < j )
|
||||
{
|
||||
@@ -130,13 +130,13 @@ getinitfile(char* buf, int size)
|
||||
}
|
||||
|
||||
#ifdef FIX_INI_FILE
|
||||
sprintf( buf, "%s/odbc.ini", DIR_INI_FILE );
|
||||
sprintf( buf, "%s/iodbc.ini", DIR_INI_FILE );
|
||||
#else
|
||||
# ifdef OS2
|
||||
*buf = '\0';
|
||||
if( NULL != getenv("ODBC_INI") )
|
||||
if( NULL != getenv("IODBC_INI") )
|
||||
{
|
||||
strcpy( buf, getenv("ODBC_INI") );
|
||||
strcpy( buf, getenv("IODBC_INI") );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -151,7 +151,7 @@ getinitfile(char* buf, int size)
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy( buf, "odbc.ini" );
|
||||
strcpy( buf, "iodbc.ini" );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -166,7 +166,7 @@ getinitfile(char* buf, int size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sprintf( buf + i, "/odbc.ini");
|
||||
sprintf( buf + i, "/iodbc.ini");
|
||||
|
||||
return buf;
|
||||
# else
|
||||
@@ -189,8 +189,8 @@ getinitfile(char* buf, int size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sprintf( buf, "%s%s", ptr, "/.odbc.ini");
|
||||
/* i.e. searching ~/.odbc.ini */
|
||||
sprintf( buf, "%s%s", ptr, "/.iodbc.ini");
|
||||
/* i.e. searching ~/.iodbc.ini */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user