void manageLang(QApplication& app){ QSettings settings; int lang = settings.value("lang", -1).toInt(); if( lang == -1){ QStringList languages; languages << "English" << "Francais" << "Spanish(not finished)"; lang = languages.indexOf(QInputDialog::getItem(0, "Preference", "Choose your language ?", languages, 0, false)); if(lang == -1){ lang = 0; } settings.setValue("lang", lang); } switch(lang){ case 0: setLang(app,"en"); break; case 1: setLang(app,"fr"); break; case 2: setLang(app,"en"); break; } }
Message::Message( Tag* tag ) : Stanza( tag ), m_subtype( Invalid ), m_htmls(0), m_bodies( 0 ), m_subjects( 0 ) { if( !tag || tag->name() != "message" ) return; const std::string& typestring = tag->findAttribute( TYPE ); if( typestring.empty() ) m_subtype = Normal; else m_subtype = (MessageType)util::lookup2( typestring, msgTypeStringValues ); const TagList& c = tag->children(); TagList::const_iterator it = c.begin(); for( ; it != c.end(); ++it ) { if( (*it)->name() == "body" ) setLang( &m_bodies, m_body, (*it) ); else if( (*it)->name() == "subject" ) setLang( &m_subjects, m_subject, (*it) ); else if( (*it)->name() == "html" ) setLang( &m_htmls, m_html, (*it) ); else if( (*it)->name() == "thread" ) m_thread = (*it)->cdata(); } }
Message::Message( MessageType type, const JID& to, const std::string& body, const std::string& subject, const std::string& thread, const std::string& xmllang ) : Stanza( to ), m_subtype( type ), m_bodies( 0 ), m_subjects( 0 ), m_thread( thread ) { setLang( &m_bodies, m_body, body, xmllang ); setLang( &m_subjects, m_subject, subject, xmllang ); }
static int id3v2_add_latin1(lame_internal_flags * gfc, uint32_t frame_id, char const *lang, char const *desc, char const *text) { if (gfc != 0) { FrameDataNode *node = 0; node = findNode(&gfc->tag_spec, frame_id, 0); if (isMultiFrame(frame_id)) { while (node) { if (isSameLang(node->lng, lang)) { if (isSameDescriptor(node, desc)) { break; } } node = findNode(&gfc->tag_spec, frame_id, node); } } if (node == 0) { node = calloc(1, sizeof(FrameDataNode)); if (node == 0) { return -254; /* memory problem */ } appendNode(&gfc->tag_spec, node); } node->fid = frame_id; setLang(node->lng, lang); node->dsc.dim = local_strdup(&node->dsc.ptr.l, desc); node->dsc.enc = 0; node->txt.dim = local_strdup(&node->txt.ptr.l, text); node->txt.enc = 0; gfc->tag_spec.flags |= (CHANGED_FLAG | ADD_V2_FLAG); } return 0; }
void FormLang::zamknij() { setLang(); setLangLibs(); close(); }
Presence::Presence( Tag* tag ) : Stanza( tag ), m_subtype( Invalid ), m_stati( 0 ), m_priority( 0 ) { if( !tag || tag->name() != "presence" ) return; const std::string& type = tag->findAttribute( TYPE ); if( type.empty() ) m_subtype = Available; else m_subtype = (PresenceType)util::lookup( type, msgTypeStringValues ); if( m_subtype == Available ) { Tag* t = tag->findChild( "show" ); if( t ) m_subtype = (PresenceType)util::lookup( t->cdata(), msgShowStringValues ); } const TagList& c = tag->children(); TagList::const_iterator it = c.begin(); for( ; it != c.end(); ++it ) { if( (*it)->name() == "status" ) setLang( &m_stati, m_status, (*it) ); else if( (*it)->name() == "priority" ) m_priority = atoi( (*it)->cdata().c_str() ); } }
void Stanza::setLang( StringMap** map, std::string& defaultLang, const Tag* tag ) { const std::string& lang = tag ? tag->findAttribute( "xml:lang" ) : EmptyString; setLang( map, defaultLang, tag ? tag->cdata() : EmptyString, lang ); }
Presence::Presence( PresenceType type, const JID& to, const std::string& status, int priority, const std::string& xmllang ) : Stanza( to ), m_subtype( type ), m_stati( 0 ) { setLang( &m_stati, m_status, status, xmllang ); setPriority( priority ); }
QSmartCard::QSmartCard( const QString &lang, QObject *parent ) : QThread( parent ) , d( new QSmartCardPrivate ) { setLang( lang ); d->t.d->readers = QStringList() << "loading"; d->t.d->cards = QStringList() << "loading"; d->t.d->card = "loading"; }
void Language::setAttribute( QDomAttr &attr) { if(attr.localName().compare("Value", Qt::CaseInsensitive)==0) { setValue(attr.value()); return; } if(attr.localName().compare("Lang", Qt::CaseInsensitive)==0) { setLang(attr.value()); return; } }
Subscription::Subscription( Tag* tag ) : Stanza( tag ), m_subtype( Invalid ), m_stati( 0 ) { if( !tag || tag->name() != "presence" ) return; m_subtype = (S10nType)util::lookup( tag->findAttribute( TYPE ), msgTypeStringValues ); const ConstTagList& c = tag->findTagList( "/presence/status" ); ConstTagList::const_iterator it = c.begin(); for( ; it != c.end(); ++it ) setLang( &m_stati, m_status, (*it) ); }
static int isSameLang(char const *l1, char const *l2) { char d[3]; int i; setLang(d, l2); for (i = 0; i < 3; ++i) { char a = tolower(l1[i]); char b = tolower(d[i]); if (a < ' ') a = ' '; if (b < ' ') b = ' '; if (a != b) { return 0; } } return 1; }
void MoreInfo::fill() { ICQUserData *data = m_data; if (data == NULL) data = &m_client->data.owner; edtHomePage->setText(m_client->toUnicode(data->Homepage.ptr, data)); initCombo(cmbGender, (unsigned short)(data->Gender.value), genders); if (spnAge->text() == "0") spnAge->setSpecialValueText(""); edtDate->setDate(data->BirthDay.value, data->BirthMonth.value, data->BirthYear.value); birthDayChanged(); unsigned l = data->Language.value; char l1 = (char)(l & 0xFF); l = l >> 8; char l2 = (char)(l & 0xFF); l = l >> 8; char l3 = (char)(l & 0xFF); initCombo(cmbLang1, l1, languages); initCombo(cmbLang2, l2, languages); initCombo(cmbLang3, l3, languages); setLang(0); urlChanged(edtHomePage->text()); }
static void setInputFileParametersCommon (inputFileInfo *finfo, vString *const fileName, const langType language, void (* setLang) (inputLangInfo *, langType), stringList *holder) { if (finfo->name != NULL) vStringDelete (finfo->name); finfo->name = fileName; if (finfo->tagPath != NULL) { if (holder) stringListAdd (holder, finfo->tagPath); else vStringDelete (finfo->tagPath); } if (0) ; else if ( Option.tagRelative == TREL_ALWAYS ) finfo->tagPath = vStringNewOwn (relativeFilename (vStringValue (fileName), getTagFileDirectory ())); else if ( Option.tagRelative == TREL_NEVER ) finfo->tagPath = vStringNewOwn (absoluteFilename (vStringValue (fileName))); else if ( Option.tagRelative == TREL_NO || isAbsolutePath (vStringValue (fileName)) ) finfo->tagPath = vStringNewCopy (fileName); else finfo->tagPath = vStringNewOwn (relativeFilename (vStringValue (fileName), getTagFileDirectory ())); finfo->isHeader = isIncludeFile (vStringValue (fileName)); setLang (& (finfo->langInfo), language); }
DWORD WINAPI decompress(LPVOID lParam/*char *archive_name*//*, vector<string> filenames*/){ sTime = time(NULL); _filename = DECOMPRESS_PREPARING; setLang(); char overwrite_mode = OVERWRITE_YES; //unsigned long uncompressed_bytes=0, compressed_bytes=0; // Input, output sizes vector<string> filename; vector<__int64> filesize; char filebuff[32768]; _size_all = 0; _done_all = 0; FILE* archive=fopen(archive_name, "rb"); //MessageBox(0,archive_name,"",0); if(archive){ _fseeki64(archive, 0LL, SEEK_END); _compressed /*= compressed_bytes*/=_ftelli64(archive); _fseeki64(archive, 0LL, SEEK_SET); if(tolower(archive_name[strlen(archive_name)-1]) == 'e' && tolower(archive_name[strlen(archive_name)-2]) == 'x' && tolower(archive_name[strlen(archive_name)-3]) == 'e'){ char buff[2048]; for(int i=0;!feof(archive);i++){ fread(buff, sizeof(*buff), sizeof(buff)/sizeof(*buff), archive); if(cmp(PROGNAME, buff)){ _fseeki64(archive, i*2048, SEEK_SET); break; }else if(cmp("ENC", buff)){ //tu nic nie robimy, to sie zrobi gdzies wczesniej } } //_fseeki64(archive, SFX_OFFSET, SEEK_SET); //_compressed -= SFX_OFFSET; sfx_arch = true; } //MessageBox(0, "", "", 0); string s=getline(archive); if (s.substr(0, string(PROGNAME).size()) != PROGNAME) { //printf("Archiwum %s nie jest w formacie " PROGNAME "\n", argv[1]); return false; } // Get option -m where m is a digit if (s.size()>2 && s[s.size()-2]=='-') { int c=s[s.size()-1]; if (c>='0' && c<='9') MEM=c-'0'; } // Read "size filename" in "%d\t%s\r\n" format while (true) { string s=getline(archive); __int64 tmpSize; sscanf(s.c_str(), "%lld", &tmpSize); if (s.size()>1) { filesize.push_back(/*atol(s.c_str())*/tmpSize); _size_all += tmpSize;//atol(s.c_str()); string::iterator tab=find(s.begin(), s.end(), '\t'); if (tab!=s.end()) filename.push_back(string(tab+1, s.end())); else filename.push_back(""); } else break; } // Test end of header for "\f\0" { int c1=0, c2=0; if ((c1=getc(archive))!='\f' || (c2=getc(archive))!=0) { //printf("%s: Zly format naglowka pliku %d %d\n", argv[1], //c1, c2); return false; } } _filename = DECOMPRESS_CREATING_DIRS; if(files4decompress.size() != 0) mkDirs(files4decompress); else mkDirs(filename); // Extract files from archive data Transformer e(DECOMPRESS, archive); for (int i=0; i<int(filename.size()); ++i) { _filename = filename[i]; const __int64 size=filesize[i]; //uncompressed_bytes+=size; _size = size; FILE *f=NULL;//=fopen(filename[i].c_str(), "wb"); if(files4decompress.size() != 0){ //MessageBox(0, "", "", 0); for(int j=0;j<files4decompress.size();j++){ if(filename[i] == files4decompress[j]){ if(_access(filename[i].c_str(), 4) == 0){ /*char errMSG[512]; sprintf(errMSG, loadString(IDS_FILE_ALREADY_EXISTS), filename[i].c_str()); if(MessageBox(0, errMSG, "KGB Archiver", MB_YESNO) == IDNO){ break; }*/ if(overwrite_mode != OVERWRITE_YES_ALL && overwrite_mode != OVERWRITE_NO_ALL) overwrite_mode = overwrite(filename[i], filesize[i]); if(overwrite_mode == OVERWRITE_NO || overwrite_mode == OVERWRITE_NO_ALL) break; } /*security update, thanks to Joxean Koret*/ if(!dirSecurityCheck(filename[i])){ _filename = DECOMPRESS_SKIPPING; }else f = fopen(filename[i].c_str(), "wb"); break; } } if(f == NULL) _filename = DECOMPRESS_SKIPPING; }else{ //bool overwrite = true; if(overwrite_mode == OVERWRITE_NO) overwrite_mode = OVERWRITE_YES; if(_access(filename[i].c_str(), 4) == 0){ /*char errMSG[512]; sprintf(errMSG, loadString(IDS_FILE_ALREADY_EXISTS), filename[i].c_str()); if(MessageBox(0, errMSG, "KGB Archiver", MB_YESNO) == IDNO){ _filename = DECOMPRESS_SKIPPING; overwrite = false; }*/ if(overwrite_mode != OVERWRITE_YES_ALL && overwrite_mode != OVERWRITE_NO_ALL) overwrite_mode = overwrite(filename[i], filesize[i]); if(overwrite_mode == OVERWRITE_NO || overwrite_mode == OVERWRITE_NO_ALL) _filename = DECOMPRESS_SKIPPING; } if((overwrite_mode == OVERWRITE_YES || overwrite_mode == OVERWRITE_YES_ALL) || _access(filename[i].c_str(), 4) != NULL){ /*security update, thanks to Joxean Koret*/ if(!dirSecurityCheck(filename[i])){ _filename = DECOMPRESS_SKIPPING; }else f = fopen(filename[i].c_str(), "wb"); } } if (f){ setvbuf(f, filebuff, _IOFBF, sizeof(filebuff)); } for (unsigned long j=0; j<size; ++j) { int c=e.decode(); if (f) putc(c, f); _done = j; } if (f) { //printf("wypakowany\n"); fclose(f); } _done_all += _size; } fclose(archive); }else return false; return true; }
//-------------------------------------------------------------- bool ofxEditorSyntax::loadFile(const std::string& xmlFile) { std::string path = ofToDataPath(xmlFile); ofXml xml; if(!xml.load(path)) { ofLogError("ofxEditorSyntax") << "couldn't load \"" << ofFilePath::getFileName(xmlFile) << "\""; return false; } auto root = xml.getChild("syntax"); if(!root) { ofLogWarning("ofxEditorSyntax") << "root xml tag not \"syntax\", ignoring"; return false; } clear(); for(auto & child : root.getChildren()) { if(child.getName() == "lang") {setLang(child.getValue());} else if(child.getName() == "files") { for(auto & file : child.getChildren()) { if(file.getName() == "ext") {addFileExt(file.getValue());} else { ofLogWarning("ofxEditorSyntax") << "ignoring unknown files xml tag \"" << file.getName() << "\""; } } } else if(child.getName() == "singlecomment") {singleLineComment = string_to_wstring(child.getValue());} else if(child.getName() == "multicomment") { auto begin = child.getChild("begin"); auto end = child.getChild("end"); if(begin) {multiLineCommentBegin = string_to_wstring(begin.getValue());} if(end) {multiLineCommentBegin = string_to_wstring(end.getValue());} } else if(child.getName() == "stringliteral") { auto begin = child.getChild("begin"); auto end = child.getChild("end"); if(begin) {stringLiteralBegin = string_to_wstring(begin.getValue());} if(end) {stringLiteralEnd = string_to_wstring(end.getValue());} } else if(child.getName() == "preprocessor") {preprocessor = string_to_wstring(child.getValue());} else if(child.getName() == "hexliteral") { std::string b = child.getValue(); if(b == "true") {setHexLiteral(true);} else if(b == "false") {setHexLiteral(false);} else { ofLogWarning("ofxEditorSyntax") << "ignoring unknown xml bool string \"" << b << "\""; } } else if(child.getName() == "operator") {operatorChars = string_to_wstring(child.getValue());} else if(child.getName() == "punctuation") {punctuationChars = string_to_wstring(child.getValue());} else if(child.getName() == "words") { for(auto &word : child.getChildren()) { if(word.getName() == "keyword") {setWord(word.getValue(), KEYWORD);} else if(word.getName() == "typename") {setWord(word.getValue(), TYPENAME);} else if(word.getName() == "function") {setWord(word.getValue(), FUNCTION);} else { ofLogWarning("ofxEditorSyntax") << "ignoring unknown words xml tag \"" << word.getName() << "\""; } } } else { ofLogWarning("ofxEditorSyntax") << "ignoring unknown xml tag \"" << child.getName() << "\""; } } return true; }
/* * Read system locales using org.freedesktop.locale1 dbus interface */ void EnabledLocalesModel::updateSystemLocales() { QDBusInterface dbusInterface( "org.freedesktop.locale1", "/org/freedesktop/locale1", "org.freedesktop.locale1", QDBusConnection::systemBus() ); QStringList localeEnviromentVariables = dbusInterface.property( "Locale" ).toStringList(); QModelIndex defaultIndex = QModelIndex(); for ( QString lev : localeEnviromentVariables ) { if ( lev.startsWith( "LANG=" ) ) { int defaultLocaleRow = findKey( lev.section( '=', 1 ) ); defaultIndex = index( defaultLocaleRow,0 ); } } setAddress( defaultIndex ); setCollate( defaultIndex ); setCtype( defaultIndex ); setIdentification( defaultIndex ); setLang( defaultIndex ); setLanguage( defaultIndex ); setMeasurement( defaultIndex ); setMonetary( defaultIndex ); setMessages( defaultIndex ); setName( defaultIndex ); setNumeric( defaultIndex ); setPaper( defaultIndex ); setTelephone( defaultIndex ); setTime( defaultIndex ); for ( QString lev : localeEnviromentVariables ) { QString value = lev.section( '=', 1 ); if ( lev.startsWith( "LC_ADDRESS=" ) ) { if ( value.isEmpty() ) setAddress( defaultIndex ); else { int row = findKey( value ); setAddress( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_COLLATE=" ) ) { if ( value.isEmpty() ) setCollate( defaultIndex ); else { int row = findKey( value ); setCollate( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_CTYPE=" ) ) { if ( value.isEmpty() ) setCtype( defaultIndex ); else { int row = findKey( value ); setCtype( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_IDENTIFICATION=" ) ) { if ( value.isEmpty() ) setIdentification( defaultIndex ); else { int row = findKey( value ); setIdentification( index( row, 0 ) ); } } else if ( lev.startsWith( "LANG=" ) ) { if ( value.isEmpty() ) setLang( defaultIndex ); else { int row = findKey( value ); setLang( index( row, 0 ) ); } } else if ( lev.startsWith( "LANGUAGE=" ) ) { if ( value.isEmpty() ) setLanguage( defaultIndex ); else { int row = findKey( value ); setLanguage( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_MEASUREMENT=" ) ) { if ( value.isEmpty() ) setMeasurement( defaultIndex ); else { int row = findKey( value ); setMeasurement( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_MESSAGES=" ) ) { if ( value.isEmpty() ) setMessages( defaultIndex ); else { int row = findKey( value ); setMessages( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_MONETARY=" ) ) { if ( value.isEmpty() ) setMonetary( defaultIndex ); else { int row = findKey( value ); setMonetary( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_NAME=" ) ) { if ( value.isEmpty() ) setName( defaultIndex ); else { int row = findKey( value ); setName( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_NUMERIC=" ) ) { if ( value.isEmpty() ) setNumeric( defaultIndex ); else { int row = findKey( value ); setNumeric( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_PAPER=" ) ) { if ( value.isEmpty() ) setPaper( defaultIndex ); else { int row = findKey( value ); setPaper( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_TELEPHONE=" ) ) { if ( value.isEmpty() ) setTelephone( defaultIndex ); else { int row = findKey( value ); setTelephone( index( row, 0 ) ); } } else if ( lev.startsWith( "LC_TIME=" ) ) { if ( value.isEmpty() ) setTime( defaultIndex ); else { int row = findKey( value ); setTime( index( row, 0 ) ); } } } }
Subscription::Subscription( S10nType type, const JID& to, const std::string& status, const std::string& xmllang ) : Stanza( to ), m_subtype( type ), m_stati( 0 ) { setLang( &m_stati, m_status, status, xmllang ); }
//------------------------------------------------------------------ LRESULT CALLBACK WndMainProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int i, notif; Tsquare *t; switch(message){ case WM_PAINT: { static PAINTSTRUCT ps; BeginPaint(hWnd, &ps); paint(ps.hdc, &ps.rcPaint); EndPaint(hWnd, &ps); } break; case WM_LBUTTONDOWN: lbutton(lParam); break; case WM_RBUTTONDOWN: rbutton(lParam); break; case WM_LBUTTONUP: if(inserting){ ReleaseCapture(); inserting=false; insertGroup(); resetSolution(); } break; case WM_MOUSEMOVE: if(inserting){ t= hitTest(lParam); if(t && t!=insSquares[insLen-1] && insLen<Nsymbol){ insSquares[insLen++]=t; } } #ifdef _DEBUGM mousemove(lParam); #endif break; case WM_TIMER: if(!IsIconic(hWin)){ playtime++; statusTime(); checkShowErr(false); } break; case WM_KEYDOWN: key(wParam); break; case WM_GETMINMAXINFO: { LPMINMAXINFO lpmm = (LPMINMAXINFO)lParam; lpmm->ptMinTrackSize.x = 250; lpmm->ptMinTrackSize.y = 200+toolH; break; } case WM_SIZE: width=LOWORD(lParam); height=HIWORD(lParam); SendMessage(toolbar, TB_AUTOSIZE, 0, 0); SendMessage(statusbar, WM_SIZE, 0, 0); onMoved(); invalidate(); break; case WM_MOVE: onMoved(); break; case WM_CLOSE: SendMessage(hWin, WM_COMMAND, ID_EXIT, 0); break; case WM_QUERYENDSESSION: writeini(); return TRUE; case WM_DESTROY: PostQuitMessage(0); break; case WM_COMMAND: notif=HIWORD(wParam); wParam=LOWORD(wParam); if(setLang(wParam)) break; if(wParam>=ID_SYMBOL && wParam<unsigned(ID_SYMBOL+size)){ select(wParam-ID_SYMBOL); break; } if(wParam>=ID_SIZE+4 && wParam<=ID_SIZE+Msize){ if(askNew()) break; size=wParam-ID_SIZE; newGameFormat(); numButtons(); break; } if(wParam>=ID_MULTI && wParam<ID_MULTI+sizeA(gameTypeA)-1){ if(askNew()) break; gameType=wParam-ID_MULTI; newGameFormat(); break; } switch(wParam){ case ID_CLEAR: noScore=true; init(false); invalidate(); break; case ID_CLEAR_ALL: noScore=true; initSquare(false); invalidate(); break; case ID_EDITOR: if(!editor){ if((undoPos==0 || done==Nsquare) && isGenerated()){ initSquare(false); } editor=true; playtime=0; noScore=true; editorChanged(); } break; case ID_EDITOR_END: if(editor){ endEditor(); editor=false; editorChanged(); } break; case ID_SOLVE: case ID_SOLVE1: if(testTotal()) break; noScore=true; if(done<Nsquare){ waitOn(); #ifdef _DEBUG DWORD time=getTickCount(); #endif Nsolution=0; curSolution=-1; //find all solutions (up to Msolution) undoAllPos=undoPos; if(wParam==ID_SOLVE1) resolve1(); else resolve(); freeGroups(); #ifdef _DEBUG status(4, _T("%d ms"), getTickCount()-time); #endif waitOff(); } if(Nsolution>0){ i=curSolution; curSolution++; if(curSolution>=Nsolution) curSolution=0; if(Nsolution>1){ if(i<0){ status(4, _T("%d %s"), Nsolution, lng(662, "solutions")); } else{ status(4, _T("%d/%d"), curSolution+1, Nsolution); } } rdSolution(); } else{ //easy solution (without recurse) or not solvable curSolution=0; status(4, _T("")); } checkErr(); invalidate(); break; case ID_CHEAT: noScore=true; if(errTime<0){ waitOn(); hint(); waitOff(); } checkShowErr(true); break; case ID_UNDO: undo(); checkErr(); break; case ID_REDO: redo(); checkErr(); break; case ID_UNDO_SYMBOL: undoSymbol(); checkErr(); break; case ID_REDO_SYMBOL: redoSymbol(); checkErr(); break; case ID_UNDO_ALL: undoAll(); checkErr(); break; case ID_REDO_ALL: while(redo()); checkErr(); break; case ID_DEL: select(-1); break; case ID_INS: select(-2); break; case ID_SIGN: select(-3); break; case ID_CONS: select(-4); break; case ID_EVEN: select(-5); break; case ID_EXIT: writeini(); DestroyWindow(hWin); break; case ID_DIAGONAL: if(askNew()) break; diag=!diag; newGameFormat(); break; case ID_SYMETRIC: if(askNew()) break; symetric=!symetric; newGameFormat(); break; case ID_LEVEL: if(DialogBox(inst, MAKEINTRESOURCE(IDD_LEVEL), hWnd, (DLGPROC)LevelProc)){ if(!editor) newGame(); } break; case ID_SHOWERR: DialogBox(inst, MAKEINTRESOURCE(IDD_ERRTIME), hWnd, (DLGPROC)ShowErrProc); break; case ID_KILLER: if(askNew()) break; killer=!killer; newGameFormat(); numButtons(); break; case ID_GREATER: if(askNew()) break; greater=!greater; newGameFormat(); break; case ID_CONSECUTIVE: if(askNew()) break; consecutive=!consecutive; newGameFormat(); if(selectedNum==-4 && !consecutive) select(-1); break; case ID_ODDEVEN: if(askNew()) break; oddeven=!oddeven; newGameFormat(); if(selectedNum==-5 && !oddeven) select(-1); break; case ID_DIGITS: case ID_LETTERS: case ID_COLORS: symbol0=wParam-350; checkMenus(); invalidate(); numButtons(); break; case ID_NEWGAME: if(editor) SendMessage(hWnd, WM_COMMAND, ID_EDITOR_END, 0); else newGame(); break; case ID_DELINI: delreg=true; break; case ID_DELHISCORE: if(MessageBox(hWnd, lng(799, "Do you really want to delete all hiscores ?"), title, MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDYES){ for(TscoreTab *tab=score; tab;){ TscoreTab *t1= tab->next; delete tab; tab=t1; } score=0; writeScore(); } break; case ID_BEST_SCORES: DialogBox(inst, MAKEINTRESOURCE(IDD_HISCORE), hWnd, (DLGPROC)ScoreProc); break; case ID_COLORDLG: DialogBox(inst, MAKEINTRESOURCE(IDD_COLORS), hWin, (DLGPROC)ColorProc); break; case ID_ABOUT: DialogBox(inst, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)AboutProc); break; case ID_HELP_README: { TCHAR *buf=(TCHAR*)_alloca(2*MAX_PATH); getExeDir(buf, lng(13, "readme.txt")); if(ShellExecute(0, _T("open"), buf, 0, 0, SW_SHOWNORMAL)==(HINSTANCE)ERROR_FILE_NOT_FOUND){ msglng(730, "Cannot open %s", buf); } } break; case ID_WRBMP: if(saveFileDlg(&bmpOfn, hWnd, 0)){ wrBmp(bmpFn, bmpOfn.nFilterIndex); } break; case ID_SAVE: if(saveFileDlg(&gameOfn, hWnd, OFN_OVERWRITEPROMPT)){ save(gameFn); } break; case ID_OPEN: if(openFileDlg(&gameOfn, hWnd, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY)){ open(gameFn); checkErr(); } break; case ID_CLEAR_GRP: resetSolution(); for(i=0; i<Ngroup; i++){ delGroup(&group[i]); } invalidate(); break; case ID_CLEAR_SGN: case ID_CLEAR_CONS: resetSolution(); for(i=0; i<Nboard; i++){ if(wParam==ID_CLEAR_SGN){ putSign(0, &board[i], 0); putSign(0, &board[i], 1); } if(wParam==ID_CLEAR_CONS){ putCons(false, &board[i], 0); putCons(false, &board[i], 1); } } invalidate(); break; case ID_MARKS: noScore=true; showMarks(); break; case ID_DELMARKS: delAllMarks(); break; case ID_PDF: if(askNew()) break; DialogBox(inst, MAKEINTRESOURCE(IDD_PDF), hWnd, (DLGPROC)PdfProc); numButtons(); break; } break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
bool setLangFromLocale() { const char* locale = setlocale(LC_MESSAGES, ""); return setLang(locale); }
//-------------------------------------------------------------- bool ofxEditorSyntax::loadFile(const string& xmlFile) { string path = ofToDataPath(xmlFile); ofXml xml; if(!xml.load(path)) { ofLogError("ofxEditorSyntax") << "couldn't load \"" << ofFilePath::getFileName(xmlFile) << "\""; return false; } xml.setToParent(); if(!xml.exists("syntax")) { ofLogWarning("ofxEditorSyntax") << "root xml tag not \"syntax\", ignoring"; return false; } xml.setTo("syntax"); int numTags = xml.getNumChildren(); clear(); for(int i = 0; i < numTags; ++i) { xml.setToChild(i); if(xml.getName() == "lang") {setLang(xml.getValue());} else if(xml.getName() == "files") { int numExts = xml.getNumChildren(); for(int e = 0; e < numExts; ++e) { xml.setToChild(e); if(xml.getName() == "ext") {addFileExt(xml.getValue());} else { ofLogWarning("ofxEditorSyntax") << "ignoring unknown files xml tag \"" << xml.getName() << "\""; } xml.setToParent(); } } else if(xml.getName() == "singlecomment") {singleLineComment = string_to_wstring(xml.getValue());} else if(xml.getName() == "multicomment") { if(xml.exists("begin")) {multiLineCommentBegin = string_to_wstring(xml.getValue("begin"));} if(xml.exists("end")) {multiLineCommentBegin = string_to_wstring(xml.getValue("end"));} } else if(xml.getName() == "preprocessor") {preprocessor = string_to_wstring(xml.getValue());} else if(xml.getName() == "hexliteral") { string b = xml.getValue(); if(b == "true") {setHexLiteral(true);} else if(b == "false") {setHexLiteral(false);} else { ofLogWarning("ofxEditorSyntax") << "ignoring unknown xml bool string \"" << b << "\""; } } else if(xml.getName() == "operator") {operatorChars = string_to_wstring(xml.getValue());} else if(xml.getName() == "punctuation") {punctuationChars = string_to_wstring(xml.getValue());} else if(xml.getName() == "words") { int numWords = xml.getNumChildren(); for(int w = 0; w < numWords; ++w) { xml.setToChild(w); if(xml.getName() == "keyword") {setWord(xml.getValue(), KEYWORD);} else if(xml.getName() == "typename") {setWord(xml.getValue(), TYPENAME);} else if(xml.getName() == "function") {setWord(xml.getValue(), FUNCTION);} else { ofLogWarning("ofxEditorSyntax") << "ignoring unknown words xml tag \"" << xml.getName() << "\""; } xml.setToParent(); } } else { ofLogWarning("ofxEditorSyntax") << "ignoring unknown xml tag \"" << xml.getName() << "\""; } xml.setToParent(); } xml.clear(); return true; }