bool GUIXSetColours( gui_window *wnd, gui_colour_set *colours ) { int size; int i; size = sizeof( ATTR ) * wnd->num_attrs; wnd->colours = (ATTR *)GUIMemAlloc( size ); if( wnd->colours == NULL ) { wnd->num_attrs = 0; return( false ); } for( i = 0; i < wnd->num_attrs; i++ ) { wnd->colours[i] = MakeAttr( colours[i].fore, colours[i].back ); } if( wnd->vbarmenu != NULL ) { #if !defined( ISQL_COLOURS ) UIData->attrs[ATTR_MENU] = wnd->colours[GUI_MENU_FRAME]; UIData->attrs[ATTR_ACTIVE] = wnd->colours[GUI_MENU_PLAIN]; UIData->attrs[ATTR_INACTIVE] = wnd->colours[GUI_MENU_GRAYED]; UIData->attrs[ATTR_CURR_INACTIVE] = wnd->colours[GUI_MENU_GRAYED_ACTIVE]; UIData->attrs[ATTR_HOT] = wnd->colours[GUI_MENU_STANDOUT]; UIData->attrs[ATTR_HOT_QUIET] = wnd->colours[GUI_MENU_STANDOUT]; UIData->attrs[ATTR_CURR_ACTIVE] = wnd->colours[GUI_MENU_ACTIVE]; UIData->attrs[ATTR_HOT_CURR] = wnd->colours[GUI_MENU_ACTIVE_STANDOUT]; #endif uimenutitlebar(); } return( true ); }
bool GUISetWndColour( gui_window *wnd, gui_attr attr, gui_colour_set *colour_set ) { if( colour_set == NULL ) { return( false ); } if( attr < wnd->num_attrs ) { wnd->colours[attr] = MakeAttr( colour_set->fore, colour_set->back ); return( true ); } return( false ); }
int OGRPDSDataSource::LoadTable(const char* pszFilename, int nRecordSize, CPLString osTableID ) { CPLString osTableFilename; int nStartBytes; CPLString osTableLink = "^"; osTableLink += osTableID; CPLString osTable = oKeywords.GetKeyword( osTableLink, "" ); if( osTable[0] == '(' ) { osTableFilename = GetKeywordSub(osTableLink, 1, ""); CPLString osStartRecord = GetKeywordSub(osTableLink, 2, ""); nStartBytes = (atoi(osStartRecord.c_str()) - 1) * nRecordSize; if (osTableFilename.size() == 0 || osStartRecord.size() == 0 || nStartBytes < 0) { CPLError(CE_Failure, CPLE_NotSupported, "Cannot parse %s line", osTableLink.c_str()); return FALSE; } CPLString osTPath = CPLGetPath(pszFilename); CleanString( osTableFilename ); osTableFilename = CPLFormCIFilename( osTPath, osTableFilename, NULL ); } else { osTableFilename = oKeywords.GetKeyword( osTableLink, "" ); if (osTableFilename.size() != 0 && osTableFilename[0] >= '0' && osTableFilename[0] <= '9') { nStartBytes = atoi(osTableFilename.c_str()) - 1; if (strstr(osTableFilename.c_str(), "<BYTES>") == NULL) nStartBytes *= nRecordSize; osTableFilename = pszFilename; } else { CPLString osTPath = CPLGetPath(pszFilename); CleanString( osTableFilename ); osTableFilename = CPLFormCIFilename( osTPath, osTableFilename, NULL ); nStartBytes = 0; } } CPLString osTableName = oKeywords.GetKeyword( MakeAttr(osTableID, "NAME"), "" ); if (osTableName.size() == 0) { if (GetLayerByName(osTableID.c_str()) == NULL) osTableName = osTableID; else osTableName = CPLSPrintf("Layer_%d", nLayers+1); } CleanString(osTableName); CPLString osTableInterchangeFormat = oKeywords.GetKeyword( MakeAttr(osTableID, "INTERCHANGE_FORMAT"), "" ); CPLString osTableRows = oKeywords.GetKeyword( MakeAttr(osTableID, "ROWS"), "" ); int nRecords = atoi(osTableRows); if (osTableInterchangeFormat.size() == 0 || osTableRows.size() == 0 || nRecords < 0) { CPLError(CE_Failure, CPLE_NotSupported, "One of TABLE.INTERCHANGE_FORMAT or TABLE.ROWS is missing"); return FALSE; } CleanString(osTableInterchangeFormat); if (osTableInterchangeFormat.compare("ASCII") != 0 && osTableInterchangeFormat.compare("BINARY") != 0) { CPLError(CE_Failure, CPLE_NotSupported, "Only INTERCHANGE_FORMAT=ASCII or BINARY is supported"); return FALSE; } VSILFILE* fp = VSIFOpenL(osTableFilename, "rb"); if (fp == NULL) { CPLError(CE_Failure, CPLE_AppDefined, "Cannot open %s", osTableFilename.c_str()); return FALSE; } CPLString osTableStructure = oKeywords.GetKeyword( MakeAttr(osTableID, "^STRUCTURE"), "" ); if (osTableStructure.size() != 0) { CPLString osTPath = CPLGetPath(pszFilename); CleanString( osTableStructure ); osTableStructure = CPLFormCIFilename( osTPath, osTableStructure, NULL ); } GByte* pabyRecord = (GByte*) VSIMalloc(nRecordSize + 1); if (pabyRecord == NULL) { VSIFCloseL(fp); return FALSE; } pabyRecord[nRecordSize] = 0; papoLayers = (OGRLayer**) CPLRealloc(papoLayers, (nLayers + 1) * sizeof(OGRLayer*)); papoLayers[nLayers] = new OGRPDSLayer(osTableID, osTableName, fp, pszFilename, osTableStructure, nRecords, nStartBytes, nRecordSize, pabyRecord, osTableInterchangeFormat.compare("ASCII") == 0); nLayers++; return TRUE; }
void GUIResetDialColours( void ) { UIData->attrs[ATTR_NORMAL] = MakeAttr( Normal.fore, Normal.back ); ColoursSet = false; }
ATTR GUIMakeColour( gui_colour fore, gui_colour back ) { return( MakeAttr( fore, back ) ); }