/* ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ */ void CMovingBallAppUi::HandleCommandL( TInt aCommand ) { switch( aCommand ) { case EResset: if(iAppView) { iAppView->Reset(); } break; case EBGLOff: if(iAppView) { iAppView->SetLights(EFalse); } break; case EBGLOn: if(iAppView) { iAppView->SetLights(ETrue); } break; case EClose: // do nothing.. break; case EEikCmdExit: case EAknSoftkeyExit: Exit(); break; case EVisitDrJukka: { OpenMobileWEBSiteL(this); } break; case EAbout: { HBufC* Abbout = KtxAbbout().AllocLC(); CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(); dlg->PrepareLC(R_ABOUT_QUERY_DIALOG); dlg->QueryHeading()->SetTextL(_L("About")); dlg->SetMessageTextL(*Abbout); TCallBack callback1(OpenMobileWEBSiteL); dlg->SetLink(callback1); dlg->SetLinkTextL(KMobileJukkaLink); dlg->RunLD(); CleanupStack::PopAndDestroy(); //Abbout } break; default: if(iAppView) { iAppView->HandleViewCommandL(aCommand); } break; } }
bool ClientHandler::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefProcessId source_process, CefRefPtr<CefProcessMessage> message) { if (message->GetName().ToString() == "show_keyboard"){ PostCallback(callback1(WhenKeyboard, true)); }else if (message->GetName().ToString() == "hide_keyboard"){ PostCallback(callback1(WhenKeyboard, false)); }else{ CefRefPtr<CefListValue> args = message->GetArgumentList(); Upp::Vector<Upp::Value> par; for (unsigned i = 0; i < args->GetSize(); i++){ CefValueType type = args->GetType(i); switch(type){ case VTYPE_BOOL: par.Add(args->GetBool(i)); break; case VTYPE_DOUBLE: par.Add(args->GetDouble(i)); break; case VTYPE_INT: par.Add(args->GetInt(i)); break; case VTYPE_STRING: par.Add(args->GetString(i).ToString().c_str()); break; default: par.Add("OnProcessMessageReceived: unsupported parameter type"); break; } } PostCallback(callback2(WhenMessage, message->GetName().ToString(), par)); } return true; }
void Ctrl::Create(HWND parent, DWORD style, DWORD exstyle, bool savebits, int show, bool dropshadow) { CreateBox cr; cr.parent = parent; cr.style = style; cr.exstyle = exstyle; cr.savebits = savebits; cr.show = show; cr.dropshadow = dropshadow; Call(callback1(this, &Ctrl::Create0, &cr)); }
void WindowsMenu(Bar& bar) { Vector<Ctrl *> w = Ctrl::GetTopWindows(); int p = 1; for(int i = 0; i < w.GetCount() && p < 10; i++) { TopWindow *q = dynamic_cast<TopWindow *>(w[i]); if(q && !q->GetOwner() && p < 10) { bar.Add(Format("&%d ", p++) + FromUnicode(q->GetTitle(), CHARSET_DEFAULT), callback1(PutForeground, Ptr<Ctrl>(q))) .Check(q->IsForeground()) .Help(t_("Activate this window")); } } if(p >= 10) bar.Add(t_("More windows.."), callback(WindowsList)); }
Layer::Layer(Layer* pLayer,double op,void* pMain) { Size szi = pLayer->m_img.GetSize(); ImageMT* ptr = (ImageMT*)pMain; Size sz = ptr->GetSize(); ImageBuffer ib(szi); PostCallback(callback1(ptr,&ImageMT::StartProg,szi.cy)); for(int i=0;i<szi.cy;i++) { // const RGBA* pOrg = pLayer->m_img[i]; const RGBA* pOrg = pLayer->GetImage(i); RGBA* pNew = ib[i]; for(int j=0;j<szi.cx;j++) { pNew[j].r = (byte)pow(pOrg[j].r,op); pNew[j].g = (byte)pow(pOrg[j].g,op); pNew[j].b = (byte)pow(pOrg[j].b,op); for(int k=0;k<100;k++) { double f = sqrt(j*32456.23145); } } PostCallback(callback(ptr,&ImageMT::Step)); } PostCallback(callback(ptr,&ImageMT::EndProg)); m_img = ib; m_rc.left = rand()/(double)RAND_MAX; m_rc.right = rand()/(double)RAND_MAX; m_rc.top = rand()/(double)RAND_MAX; m_rc.bottom = rand()/(double)RAND_MAX; }
void main() { WItemsNum = __VERIFIER_nondet_int(); while(1) { while(WItemsNum<=5 || MoreWItems()) { if (WItemsNum<=5) { callback1(); WItemsNum++; } else { WItemsNum++; } } while(WItemsNum>2) { callback2(); WItemsNum--; } } while(1) {} }
inline void body() { WItemsNum = nondet(); while(1) { while(WItemsNum<=5 || MoreWItems()) { if (WItemsNum<=5) { callback1(); WItemsNum++; } else { WItemsNum++; } } while(WItemsNum>2) { callback2(); WItemsNum--; } } while(1) {} }
static void *sound_rpc_server(int funcno, void *data, int size) { uint32_t *param = data; funcno = funcno; size = size; if (param[0] & 0x01) { /* DMA 0 */ if(callback1 != NULL) { return (void *) callback1(callback1_arg, 0); } } if (param[0] & 0x02) { /* DMA 1 */ if(callback2 != NULL) { return (void *) callback2(callback2_arg, 1); } } return NULL; }
void runTest () { beginTestCase ("create"); Factory <Object> factory; Callback1 callback1 (factory); Callback2 callback2 (factory); Object object (*this); factory.create_interfaces (object); // find existing interfaces expect (object.find_interface <Interface1> () != nullptr); expect (object.find_interface <Interface2> () != nullptr); // add duplicate interface try { object.add_interface (new Interface1); fail ("uncaught exeption"); } catch (std::invalid_argument const&) { pass (); } // request missing interface try { struct MissingInterface { }; object.get_interface <MissingInterface> (); fail ("uncaught exeption"); } catch (std::bad_cast const&) { pass (); } }
void body() { __rho_1_ = nondet(); WItemsNum = __rho_1_; while(1) { while(1) { __rho_2_ = MoreWItems(); if (WItemsNum<=5) { if (__rho_2_>0) break; } if (WItemsNum<=5) { callback1(); WItemsNum++; } else { WItemsNum++; } } while(1) { if (!(WItemsNum>2)) break; callback2(); WItemsNum--; } } while(1) { dummy=dummy; } L_return: return 0; }
void TopicEditor::JumpToDefinition() { PostCallback(callback1(IdeGotoCodeRef, editor.GetFormatInfo().label)); }
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& url) { PostCallback(callback1(WhenUrlChange, url.ToString())); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CMgAppUi::HandleCommandL(TInt aCommand) { switch (aCommand) { case EVisitDrJukka: { OpenMobileWEBSiteL(this); } break; case EAbout: { HBufC* Abbout(NULL); if(KAppIsTrial) Abbout = KtxAboutText2().AllocLC(); else Abbout = KtxAboutText1().AllocLC(); TPtr Pointter(Abbout->Des()); CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter); dlg->PrepareLC(R_AVKON_MESSAGE_QUERY_DIALOG); dlg->QueryHeading()->SetTextL(KtxtApplicationName()); TCallBack callback1(OpenMobileWEBSiteL); dlg->SetLink(callback1); dlg->SetLinkTextL(KMobileJukkaLink); dlg->RunLD(); CleanupStack::PopAndDestroy(Abbout); } break; case EClose2: if(iTimeOutTimer) { iTimeOutTimer->Cancel(); TimerExpired(); } break; case EClose: case EAknSoftkeyExit: case EEikCmdExit: if(iMainContainer) { TRAPD(Errr,iMainContainer->SaveValuesL()); RemoveFromStack(iMainContainer); // will close the DB... delete iMainContainer; iMainContainer = NULL; } TRAPD(Errr,DoExitChecksNowL()); Exit(); break; case EQuickExit: Exit(); break; default: if(iMainContainer) iMainContainer->HandleViewCommandL(aCommand); break; } }
void WorkspaceWork::FileMenu(Bar& menu) { bool sel = filelist.IsCursor() && filelist[filelist.GetCursor()].isdir; bool isaux = IsAux(); if(isaux) InsertSpecialMenu(menu); else { menu.Add(!isaux, "Insert package directory file(s)", THISBACK1(AddFile, PACKAGE_FILE)) .Help("Insert file relative to current package"); menu.Add(!isaux, "Insert topic++ group", THISBACK(AddTopicGroup)); menu.Add("Special", THISBACK(SpecialFileMenu)) .Help("Less frequently used methods of adding files to the package"); } menu.Add("Insert separator", THISBACK(AddSeparator)) .Help("Insert text separator line"); menu.Separator(); if(!organizer) { if(sel) menu.Add(closed.Find(GetActiveSepfo()) < 0 ? "Close group\t[double-click]" : "Open group\t[double-click]", THISBACK(Group)); menu.Add("Open all groups", THISBACK(OpenAllGroups)); menu.Add("Close all groups", THISBACK(CloseAllGroups)); menu.Separator(); BuildFileMenu(menu); menu.Separator(); } menu.Add("Rename...", THISBACK(RenameFile)) .Help("Rename file / separator / topic group"); menu.Add("Remove", THISBACK(RemoveFile)) .Key(organizer ? K_DELETE : K_ALT_DELETE) .Help("Remove file / separator / topic group from package"); menu.Add(filelist.IsCursor() && !sel, "Delete", THISBACK(DelFile)) .Help("Remove file / topic group reference from package & delete file / folder on disk"); menu.Separator(); menu.Add("Open File Directory",THISBACK(OpenFileFolder)); menu.Add("Copy File Path", callback1(WriteClipboardText, GetActiveFilePath())); menu.Separator(); menu.Add(filelist.GetCursor() > 0, "Move up", THISBACK1(MoveFile, -1)) .Key(organizer ? K_CTRL_UP : K_SHIFT_CTRL_UP) .Help("Move current file one position towards package beginning"); menu.Add(filelist.IsCursor() && filelist.GetCursor() < filelist.GetCount() - 1, "Move down", THISBACK1(MoveFile, 1)) .Key(organizer ? K_CTRL_DOWN : K_SHIFT_CTRL_DOWN) .Help("Move current file one position towards package end"); if(IsActiveFile()) { menu.Separator(); String p = GetActiveFilePath(); String ext = GetFileExt(p); if(ext == ".tpp" && IsFolder(p)) { menu.Add("Includeable topic group", THISBACK(ToggleIncludeable)) .Check(FileExists(AppendFileName(p, "all.i"))); if(IsSvnDir(p)) menu.Add("Svn Synchronize " + p, THISBACK1(SyncSvnDir, p)); } else { menu.Add("Optimize for speed", THISBACK(ToggleFileSpeed)) .Check(ActiveFile().optimize_speed); if(IsHeaderExt(ext)) menu.Add("Precompile header", THISBACK(TogglePCH)) .Check(ActiveFile().pch); } } FilePropertiesMenu(menu); }
static int callback1_wrapper (int(*callback1)(int), int a) { return callback1(a) + 10; }
void Ide::SetupFormat() { FormatDlg dlg; dlg.Title("Format setup"); WithSetupFontLayout<ParentCtrl> fnt; WithSetupHlLayout<ParentCtrl> hlt; WithSetupEditorLayout<ParentCtrl> edt; WithSetupIdeLayout<ParentCtrl> ide; WithSetupAssistLayout<ParentCtrl> assist; WithSetupMobilePlatformsLayout<ParentCtrl> mobile; AStyleSetupDialog ast(this); #ifdef PLATFORM_WIN32 ide.console_txt.Hide(); ide.console.Hide(); ide.kde.Hide(); ide.gnome.Hide(); ide.xterm.Hide(); ide.mate.Hide(); #endif ide.kde <<= callback2(SetConsole, &ide.console, "/usr/bin/konsole -e"); ide.gnome <<= callback2(SetConsole, &ide.console, "/usr/bin/gnome-terminal -x"); ide.mate <<= callback2(SetConsole, &ide.console, "/usr/bin/mate-terminal -x"); ide.xterm <<= callback2(SetConsole, &ide.console, "/usr/bin/xterm -e"); edt.lineends .Add(LF, "LF") .Add(CRLF, "CRLF") .Add(DETECT_LF, "Detect with default LF") .Add(DETECT_CRLF, "Detect with default CRLF"); edt.filetabs .Add(AlignedFrame::LEFT, "Left") .Add(AlignedFrame::TOP, "Top") .Add(AlignedFrame::RIGHT, "Right") .Add(AlignedFrame::BOTTOM, "Bottom") .Add(-1, "Off"); edt.tabs_crosses .Add(AlignedFrame::LEFT, "Left") .Add(AlignedFrame::RIGHT, "Right") .Add(-1, "Off"); dlg.Add(fnt, "Fonts"); dlg.Add(hlt, "Syntax highlighting"); dlg.Add(edt, "Editor"); dlg.Add(assist, "Assist"); dlg.Add(ide, "IDE"); dlg.Add(ast, "Code formatting"); dlg.Add(mobile, "Mobile platforms"); dlg.WhenClose = dlg.Acceptor(IDEXIT); FontSelectManager ed, vf, con, f1, f2, tf; ed.Set(fnt.face, fnt.height, fnt.bold, fnt.italic, fnt.naa); vf.Set(fnt.vface, fnt.vheight, fnt.vbold, fnt.vitalic, fnt.vnaa); con.Set(fnt.cface, fnt.cheight, fnt.cbold, fnt.citalic, fnt.cnaa); tf.Set(fnt.tface, fnt.theight, fnt.tbold, fnt.titalic, fnt.tnaa); f1.Set(fnt.face1, fnt.height1, fnt.bold1, fnt.italic1, fnt.naa1); f2.Set(fnt.face2, fnt.height2, fnt.bold2, fnt.italic2, fnt.naa2); ed.Set(editorfont); vf.Set(veditorfont); con.Set(consolefont); tf.Set(tfont); f1.Set(font1); f2.Set(font2); DlCharset(edt.charset); edt.tabsize.MinMax(1, 100).NotNull(); edt.tabsize <<= editortabsize; edt.indent_amount.MinMax(1, 100).NotNull(); edt.indent_amount <<= indent_spaces ? indent_amount : editortabsize; edt.indent_amount.Enable(indent_spaces); CtrlRetriever rtvr; int hs = hilite_scope; rtvr (hlt.hilite_scope, hs) (hlt.hilite_bracket, hilite_bracket) (hlt.hilite_ifdef, hilite_ifdef) (hlt.hilite_if_endif, hilite_if_endif) (hlt.thousands_separator, thousands_separator) (hlt.hline, hline) (edt.indent_spaces, indent_spaces) (edt.no_parenthesis_indent, no_parenthesis_indent) (edt.showtabs, show_tabs) (edt.warnwhitespace, warnwhitespace) (edt.lineends, line_endings) (edt.numbers, line_numbers) (edt.bookmark_pos, bookmark_pos) (edt.bordercolumn, bordercolumn) (edt.bordercolor, bordercolor) (edt.findpicksel, find_pick_sel) (edt.findpicktext, find_pick_text) (edt.deactivate_save, deactivate_save) (edt.filetabs, filetabs) (edt.tabs_icons, tabs_icons) (edt.tabs_crosses, tabs_crosses) (edt.tabs_grouping, tabs_grouping) (edt.tabs_stacking, tabs_stacking) (edt.tabs_serialize, tabs_serialize) (edt.persistent_find_replace, persistent_find_replace) (edt.find_replace_restore_pos, find_replace_restore_pos) (assist.barline, barline) (assist.auto_enclose, auto_enclose) (assist.commentdp, editor.commentdp) (assist.header_guards, header_guards) (assist.insert_include, insert_include) (assist.mark_lines, mark_lines) (assist.qtfsel, qtfsel) (assist.assist, editor.auto_assist) (ide.showtime, showtime) (ide.show_status_bar, show_status_bar) (ide.toolbar_in_row, toolbar_in_row) (ide.splash_screen, splash_screen) (ide.sort, sort) (ide.mute_sounds, mute_sounds) (ide.wrap_console_text, wrap_console_text) (ide.hydra1_threads, hydra1_threads) (ide.gdbSelector, gdbSelector) (ide.chstyle, chstyle) (ide.console, LinuxHostConsole) (ide.output_per_assembly, output_per_assembly) (ast.BracketIndent, astyle_BracketIndent) (ast.NamespaceIndent, astyle_NamespaceIndent) (ast.BlockIndent, astyle_BlockIndent) (ast.CaseIndent, astyle_CaseIndent) (ast.ClassIndent, astyle_ClassIndent) (ast.LabelIndent, astyle_LabelIndent) (ast.SwitchIndent, astyle_SwitchIndent) (ast.PreprocessorIndent, astyle_PreprocessorIndent) (ast.MinInStatementIndentLength, astyle_MinInStatementIndentLength) (ast.MaxInStatementIndentLength, astyle_MaxInStatementIndentLength) (ast.BreakClosingHeaderBracketsMode,astyle_BreakClosingHeaderBracketsMode) (ast.BreakElseIfsMode, astyle_BreakElseIfsMode) (ast.BreakOneLineBlocksMode, astyle_BreakOneLineBlocksMode) (ast.SingleStatementsMode, astyle_SingleStatementsMode) (ast.BreakBlocksMode, astyle_BreakBlocksMode) (ast.BreakClosingHeaderBlocksMode, astyle_BreakClosingHeaderBlocksMode) (ast.BracketFormatMode, astyle_BracketFormatMode) (ast.ParensPaddingMode, astyle_ParensPaddingMode) (ast.ParensUnPaddingMode, astyle_ParensUnPaddingMode) (ast.OperatorPaddingMode, astyle_OperatorPaddingMode) (ast.EmptyLineFill, astyle_EmptyLineFill) (ast.TabSpaceConversionMode, astyle_TabSpaceConversionMode) (ast.TestBox, astyle_TestBox) (mobile.AndroidSDKPath, androidSDKPath) ; hlt.hlstyle.AddColumn("Style"); hlt.hlstyle.AddColumn("Color").Ctrls(HlPusherFactory); hlt.hlstyle.AddColumn("Bold").Ctrls<Option>(); hlt.hlstyle.AddColumn("Italic").Ctrls<Option>(); hlt.hlstyle.AddColumn("Underline").Ctrls<Option>(); hlt.hlstyle.ColumnWidths("211 80 45 45 80"); hlt.hlstyle.EvenRowColor().NoHorzGrid().SetLineCy(EditField::GetStdHeight() + 2); ReadHlStyles(hlt.hlstyle); edt.charset <<= (int)default_charset; edt.tabsize <<= rtvr <<= hlt.hlstyle.WhenCtrlsAction = ed.WhenAction = tf.WhenAction = con.WhenAction = f1.WhenAction = f2.WhenAction = dlg.Breaker(222); ide.showtimeafter <<= Nvl((Date)FileGetTime(ConfigFile("version")), GetSysDate() - 1); hlt.hl_restore <<= dlg.Breaker(333); ide.chstyle.Add(0, "Host platform"); ide.chstyle.Add(1, "Standard"); ide.chstyle.Add(2, "Classic"); ide.chstyle.Add(3, "Host platform, blue bars"); ide.chstyle.Add(4, "Standard, blue bars"); FrameRight<Button> uscBrowse; uscBrowse.SetImage(CtrlImg::right_arrow()); uscBrowse <<= callback1(AddPath, &ide.uscpath); ide.uscpath.AddFrame(uscBrowse); ide.uscpath <<= LoadFile(GetHomeDirFile("usc.path")); FrameRight<Button> androidSDKDownload; androidSDKDownload.SetImage(IdeImg::DownloadBlack()); androidSDKDownload.Tip("Download"); androidSDKDownload <<= callback1(LaunchWebBrowser, AndroidSDK::GetDownloadUrl()); mobile.AndroidSDKPath.AddFrame(androidSDKDownload); FrameRight<Button> androidSDKBrowse; androidSDKBrowse.SetImage(CtrlImg::right_arrow()); androidSDKBrowse.Tip("Select directory"); androidSDKBrowse <<= callback1(InsertPath, &mobile.AndroidSDKPath); mobile.AndroidSDKPath.AddFrame(androidSDKBrowse); mobile.AndroidSDKPath <<= androidSDKPath; for(;;) { int c = dlg.Run(); Upp::SaveFile(GetHomeDirFile("usc.path"), ~ide.uscpath); editorfont = ed.Get(); tfont = tf.Get(); veditorfont = vf.Get(); consolefont = con.Get(); font1 = f1.Get(); font2 = f2.Get(); editortabsize = Nvl((int)~edt.tabsize, 4); rtvr.Retrieve(); console.SetSlots(minmax(hydra1_threads, 1, 256)); hilite_scope = hs; if(indent_spaces) indent_amount = ~edt.indent_amount; else { indent_amount = editortabsize; edt.indent_amount <<= editortabsize; } edt.indent_amount.Enable(indent_spaces); default_charset = (byte)(int)~edt.charset; for(int i = 0; i < CodeEditor::HL_COUNT; i++) editor.SetHlStyle(i, hlt.hlstyle.Get(i, 1), hlt.hlstyle.Get(i, 2), hlt.hlstyle.Get(i, 3), hlt.hlstyle.Get(i, 4)); UpdateFormat(); if(c == IDEXIT) break; if(c == 333 && PromptYesNo("Restore default highlighting colors?")) { editor.DefaultHlStyles(); ReadHlStyles(hlt.hlstyle); } } FileSetTime(ConfigFile("version"), ToTime(~ide.showtimeafter)); FinishConfig(); SaveConfig(); }