Esempio n. 1
0
void DialogWithHelp::OnHelp(wxCommandEvent &ev)
{
	wxString page = GetHelpPage();

	if (!page.IsEmpty())
	{
		if (page.StartsWith(wxT("pg/")))
			DisplayHelp(page.Mid(3), HELP_POSTGRESQL);
		else if (page.StartsWith(wxT("slony/")))
			DisplayHelp(page.Mid(6), HELP_SLONY);
		else
			DisplayHelp(page, HELP_PGADMIN);
	}
}
Esempio n. 2
0
bool ParseCommandLine(int argc, LPTSTR argv[])
{
	for (int i=1; i<argc; i++)
	{
		LPCTSTR szOption = argv[i];
		if (szOption[0] == '-' || szOption[0] == '/')
		{
			szOption++;
			if (strcmp(szOption, "?") == 0)
				return DisplayHelp();
			else if (_stricmp(szOption, "at") == 0)
			{
				if (g_eat != ExamineAccessTokenDefault)
					return DisplayHelp();
				g_eat = ExamineAccessTokenYes;
			}
			else if (_stricmp(szOption, "no_at") == 0)
			{
				if (g_eat != ExamineAccessTokenDefault)
					return DisplayHelp();
				g_eat = ExamineAccessTokenNo;
			}
			else if (_stricmp(szOption, "file") == 0)
			{
				if (g_eot != ExamineObjectTypeDefault)
					return DisplayHelp();
				g_eot = ExamineObjectTypeFile;
			}
			else if (_stricmp(szOption, "regkey") == 0)
			{
				if (g_eot != ExamineObjectTypeDefault)
					return DisplayHelp();
				g_eot = ExamineObjectTypeRegkey;
			}
			else if (_stricmp(szOption, "service") == 0)
			{
				if (g_eot != ExamineObjectTypeDefault)
					return DisplayHelp();
				g_eot = ExamineObjectTypeService;
			}
			else if (_stricmp(szOption, "kernel") == 0)
			{
				if (g_eot != ExamineObjectTypeDefault)
					return DisplayHelp();
				g_eot = ExamineObjectTypeKernel;
			}
			else if (_stricmp(szOption, "printer") == 0)
			{
				if (g_eot != ExamineObjectTypeDefault)
					return DisplayHelp();
				g_eot = ExamineObjectTypePrinter;
			}
		}
		else
			g_aObjects.Add(szOption);
	}

	return true;
}
Esempio n. 3
0
int main(int argc, char** argv) {
    struct global_data_t globals;

    if (argc < 2 || 
        (std::string(argv[1]) != "count" && std::string(argv[1]) != "build") ) {
        DisplayHelp(argv[0]);
        exit(1);
    }

    if (std::string(argv[1]) == "count") {
        ParsePhase1Option(argc - 1, argv + 1);

        globals.kmer_k = phase1_options.kmer_k;
        globals.kmer_freq_threshold = phase1_options.min_edge_freq;
        globals.max_read_length = phase1_options.max_read_length;
        globals.host_mem = phase1_options.host_mem;
        globals.gpu_mem = phase1_options.gpu_mem;
        globals.num_cpu_threads = phase1_options.num_cpu_threads;
        globals.phase1_num_output_threads = phase1_options.num_output_threads;
        globals.input_file = phase1_options.input_file.c_str();
        globals.output_prefix = phase1_options.output_prefix.c_str();

        log ("Host memory to be used: %ld\n", globals.host_mem);
        log ("Number CPU threads: %d\n", globals.num_cpu_threads);

#ifndef DISABLE_GPU
        log ("GPU memory to be used: %ld\n",  globals.gpu_mem);
        if (globals.gpu_mem < 2147483648LL) {
            err("Warning, maybe not enough GPU memory. At least 2G is recommended. Process will be continue though.\n");
        }
#endif

        phase1::Phase1Entry(globals);
    } else if (std::string(argv[1]) == "build") {
        ParsePhase2Option(argc - 1, argv + 1);

        globals.need_mercy = phase2_options.need_mercy;
        globals.host_mem = phase2_options.host_mem;
        globals.gpu_mem = phase2_options.gpu_mem;
        globals.num_cpu_threads = phase2_options.num_cpu_threads;
        globals.phase1_num_output_threads = phase2_options.num_edge_files;
        globals.phase2_num_output_threads = phase2_options.num_output_threads;
        globals.phase2_input_prefix = phase2_options.input_prefix.c_str();
        globals.output_prefix = phase2_options.output_prefix.c_str();
        globals.max_read_length = phase2_options.max_read_length;

        log ("Host memory to be used: %ld\n", globals.host_mem);
        log ("Number CPU threads: %d\n", globals.num_cpu_threads);

#ifndef DISABLE_GPU
        log ("GPU memory to be used: %ld\n",  globals.gpu_mem);
        if (globals.gpu_mem < 2147483648LL) {
            err("Warning, maybe not enough GPU memory. At least 2G is recommended. Process will be continue though.\n");
        }
#endif
        phase2::Phase2Entry(globals);
    }

    return 0;
}
Esempio n. 4
0
/*--------------------------------------------------------------------------*/
SIGNED HelpMenuClass::Message(const PegMessage &Mesg)
{
		MainMenuClass *pMainWindow;

    switch (Mesg.wType)
    {
		
		case PM_KEYLEFT:
		case PM_KEYRIGHT:
				switch(Mesg.iData)
				{
					case HelpSelectionButtonID:
						if (Mesg.wType == PM_KEYRIGHT)
						{
						}
						else
						{
						}
						DisplayHelp(); /* setup help window */
						break;
				}
				break;

		case PM_CLOSE:
			  /* left key = close = go back to previous menu */
				Destroy(this);
				pMainWindow = (MainMenuClass*) Presentation()->Find(MAIN_MENU_ID);
				pMainWindow->SetBitmap(&gbMainBitmap);
				break;

    default:
        return PegWindow::Message(Mesg);
    }
    return 0;
}
Esempio n. 5
0
void MenuInstanceData::Menus(const string& menuDirectory, const string& menuName) {
  path = menuDirectory;
  menu = menuName;

  if (Open()) {
    if (header.nNumbers == MENU_NUMFLAG_DIRNUMBER && udir[0].subnum == -1) {
      bout << "\r\nYou cannot currently access the file section.\r\n\n";
      Close();
      return;
    }
    // if flagged to display help on entrance, then do so
    if (session()->user()->IsExpert() && header.nForceHelp == MENU_HELP_ONENTRANCE) {
      DisplayHelp();
    }

    while (!hangup && !finished) {
      PrintMenuPrompt(this);
      const string command = GetCommand(this);
      MenuExecuteCommand(this, command);
    }
  } else if (IsEqualsIgnoreCase(menuName.c_str(), "main")) {     // default menu name
    hangup = true;
  }
  Close();
}
Esempio n. 6
0
static int AsciitabProc(WINDOW wnd,MESSAGE msg, PARAM p1,PARAM p2)
{
    switch (msg)    {
        case CREATE_WINDOW:
            DefaultWndProc(wnd, msg, p1, p2);
            CreateWindowMsg(wnd);
            return TRUE;
        case KEYBOARD:
            if (KeyboardMsg(wnd, p1))
                return TRUE;
            break;
        case PAINT:
            DefaultWndProc(wnd, msg, p1, p2);
            DisplayAsciitab(wnd);
            return TRUE;
        case COMMAND:
            if ((int)p1 == ID_HELP)    {
                DisplayHelp(wnd, "ASCII Table");
                return TRUE;
            }
            break;
        case CLOSE_WINDOW:
            ATwnd = NULL;
            break;
        default:
            break;
    }
    return DefaultWndProc(wnd, msg, p1, p2);
}
Esempio n. 7
0
void CAppParamParser::ParseArg(const CStdString &arg)
{
  if (arg == "-fs" || arg == "--fullscreen")
    g_advancedSettings.m_startFullScreen = true;
  else if (arg == "-h" || arg == "--help")
    DisplayHelp();
  else if (arg == "-v" || arg == "--version")
    DisplayVersion();
  else if (arg == "--standalone")
    g_application.SetStandAlone(true);
  else if (arg == "-p" || arg  == "--portable")
    g_application.EnablePlatformDirectories(false);
  else if (arg == "--debug")
    EnableDebugMode();
  else if (arg == "--legacy-res")
    g_application.SetEnableLegacyRes(true);
  else if (arg == "--test")
    m_testmode = true;
  else if (arg.substr(0, 11) == "--settings=")
    g_advancedSettings.AddSettingsFile(arg.substr(11));
  else if (arg.length() != 0 && arg[0] != '-')
  {
    if (m_testmode)
      g_application.SetEnableTestMode(true);
    CFileItemPtr pItem(new CFileItem(arg));
    pItem->SetPath(arg);
    m_playlist.Add(pItem);
  }
}
Esempio n. 8
0
void cOsdMenu::SetHelp(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
    // strings are NOT copied - must be constants!!!
    helpRed    = Red;
    helpGreen  = Green;
    helpYellow = Yellow;
    helpBlue   = Blue;
    DisplayHelp(true);
}
Esempio n. 9
0
bool wxExtHelpController::DisplaySection(const wxString& section)
{
    bool isFilename = (section.Find(wxT(".htm")) != -1);

    if (isFilename)
        return DisplayHelp(section);
    else
        return KeywordSearch(section);
}
Esempio n. 10
0
bool ParseOptions(int argc, char** argv, std::string& configPath, 
                  bool& siteop, bool& raw, std::string& templatePath)
{
  po::options_description visible("supported options");
  visible.add_options()
    ("help,h", "display this help message")
    ("version,v", "display version")
    ("config-path,c", po::value<std::string>(&configPath), "specify location of config file")
    ("siteop,s", "site who")
    ("raw,r", "raw formatting")
    ("template,y", po::value<std::string>(&templatePath), "template file path")
  ;
  
  po::variables_map vm;
  try
  {
    po::store(po::command_line_parser(argc, argv).options(visible).run(), vm);

    if (vm.count("help"))
    {
      DisplayHelp(argv[0], visible);
      return false;
    }

    if (vm.count("version"))
    {
      DisplayVersion();
      return false;
    }

    po::notify(vm);
  }
  catch (const po::error& e)
  {
    std::cerr << e.what() << std::endl;
    DisplayHelp(argv[0], visible);
    return false;
  }
  
  siteop = vm.count("siteop") > 0;
  raw = vm.count("raw") > 0;
  
  return true;
}
Esempio n. 11
0
void cOsdMenu::Display(void)
{
  if (subMenu) {
     subMenu->Display();
     return;
     }
  displayMenu->SetMessage(mtStatus, NULL);
  displayMenu->Clear();
  cStatus::MsgOsdClear();
  if (menuCategory != displayMenu->MenuCategory())
     displayMenu->SetMenuCategory(menuCategory);
  displayMenuItems = displayMenu->MaxItems();
  cStatus::MsgOsdMenuDisplay(MenuKind());
#ifdef REELVDR
  /* EnableSideNote here, before SetTitle() since
     SetTitle draws the SideNote-background */
  displayMenu->EnableSideNote(enableSideNote);
#endif
  displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX
  displayMenu->SetTitle(title);
  cStatus::MsgOsdTitle(title);
  DisplayHelp(true);
  int count = Count();
  if (count > 0) {
     int ni = 0;
     for (cOsdItem *item = First(); item; item = Next(item)) {
         cStatus::MsgOsdItem(item->Text(), ni++);
         if (current < 0 && item->Selectable())
            current = item->Index();
         }
     if (current < 0)
        current = 0; // just for safety - there HAS to be a current item!
     first = min(first, max(0, count - displayMenuItems)); // in case the menu size has changed
     if (current - first >= displayMenuItems || current < first) {
        first = current - displayMenuItems / 2;
        if (first + displayMenuItems > count)
           first = count - displayMenuItems;
        if (first < 0)
           first = 0;
        }
     int i = first;
     int n = 0;
     for (cOsdItem *item = Get(first); item; item = Next(item)) {
         bool CurrentSelectable = (i == current) && item->Selectable();
         item->SetMenuItem(displayMenu, i - first, CurrentSelectable, item->Selectable());
         if (CurrentSelectable)
            cStatus::MsgOsdCurrentItem(item->Text());
         if (++n == displayMenuItems)
            break;
         i++;
         }
     }
  displayMenu->SetScrollbar(count, first);
  if (!isempty(status))
     displayMenu->SetMessage(mtStatus, status);
}
// Main window KeyDown event handler
VOID Listbox_OnKeyDown(WPARAM wParam, LPARAM lParam)
{
    switch(wParam)
    {
    case VK_ESCAPE:
        SendMessage(hMainWin, WM_DESTROY, 0, 0);
        break;
    case VK_F5:
        Refresh();
        break;
    case VK_F1:
        DisplayHelp();
        break;
    }
}
Esempio n. 13
0
void cOsdMenu::DisplayCurrent(bool Current)
{
  cOsdItem *item = Get(current);
  if (item) {
     displayMenu->SetItem(item->Text(), current - first, Current && item->Selectable(), item->Selectable());
     if (Current && item->Selectable())
        cStatus::MsgOsdCurrentItem(item->Text());
     if (!Current)
        item->SetFresh(true); // leaving the current item resets 'fresh'
     if (cMenuEditItem *MenuEditItem = dynamic_cast<cMenuEditItem *>(item)) {
        if (!MenuEditItem->DisplayHelp())
           DisplayHelp();
        else
           helpDisplayed = false;
        }
     }
}
Esempio n. 14
0
void cOsdMenu::SetHelp(const char *Red, const char *Green, const char *Yellow, const char *Blue, const eKeys *Keys)
{
  helpKeys   = Keys;
#else
void cOsdMenu::SetHelp(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
#endif /*REELVDR*/
  // strings are NOT copied - must be constants!!!
  helpRed    = Red;
  helpGreen  = Green;
  helpYellow = Yellow;
  helpBlue   = Blue;
  DisplayHelp(true);
#ifdef REELVDR
  displayMenu->SetKeys(helpKeys);
#endif
}
Esempio n. 15
0
PatcherOptions::PatcherOptions(int argc, char* argv[]) : m_displayHelp(false), m_displayVersion(false),
	m_interactive(true), m_patchToRealLength(false), m_timeInSeconds(105),
	m_lengthConditionType(condition_none), m_lengthCondition(120), m_startingPaths()
{
	po::options_description desc = GetCmdOptions();

	po::positional_options_description positionalOptions;
	positionalOptions.add("patchpaths", -1);

	po::variables_map vm;
	po::store(po::command_line_parser(argc, argv).options(desc).positional(positionalOptions).run(), vm);
	po::notify(vm);

	DisplayHelp(vm.count("help") > 0);
	DisplayVersion(vm.count("version") > 0);
	Interactive(vm.count("not-interactive") == 0);

	bool unpatch = vm.count("unpatch") > 0;
	bool patchall = vm.count("patchall") > 0;

	if(vm.count("patchpaths"))
	{
		SetStartingPaths(vm["patchpaths"].as<vector<string> >());
	}
	else
	{
		StartingPaths().push_back(fs::initial_path().string());
	}

	if(!unpatch)
	{
		TimeInSeconds(105);
		UseLengthGreaterThanCondition(120);
	}
	else
	{
		PatchToRealLength();
		UseLengthEqualCondition(105);
	}

	if(patchall)
	{
		DontUseLengthCondition();
	}
}
Esempio n. 16
0
LRESULT CAppWindow::OnCommand(WORD wID)
{
	switch (wID)
	{
	case ID_TRAYICON_EXIT:
		SendMessage(WM_SYSCOMMAND, SC_CLOSE);
		break;

	case ID_TRAYICON_CHECKFORUPDATESNOW:
		m_fManualUpdateCheck = TRUE;

		CheckForUpdates();
		break;

	case ID_TRAYICON_INBOX:
		OpenInbox();
		break;

	case ID_TRAYICON_LOGIN:
		PromptForCredentials();
		break;

	case ID_TRAYICON_SIGNOUT:
		SignOut(TRUE);
		break;

	case ID_TRAYICON_HELP:
		DisplayHelp();
		break;

	case ID_TRAYICON_ABOUT:
		(new CAboutDialog())->Create(DT_ABOUT, this);
		break;

	case ID_TRAYICON_OPTIONS:
		(new COptionsSheet())->Create(DT_OPTIONS, this);
		break;

	case ID_TRAYICON_CHECKWAVESNOW:
		CheckWavesNow();
		break;
	}

	return 0;
}
Esempio n. 17
0
void ProcessCommandLine (int argc, char* argv[])
{

  if ( argc <= 1 )
  {
    DisplayHelp();
    exit (0);
  }
  else
  {
    _tInputFileName   = argv [1];
    _tInputFileFormat = FileExtension (_tInputFileName);

    cout << "File : " << _tInputFileName << endl;
    cout << "Type : " << _tInputFileFormat << endl;
  }

}  /* ProcessCommandLine() */
Esempio n. 18
0
bool wxExtHelpController::DisplaySection(int sectionNo)
{
   if (! m_NumOfEntries)
      return false;

   wxBusyCursor b; // display a busy cursor
   wxList::compatibility_iterator node = m_MapList->GetFirst();
   wxExtHelpMapEntry *entry;
   while (node)
   {
      entry = (wxExtHelpMapEntry *)node->GetData();
      if (entry->id == sectionNo)
         return DisplayHelp(entry->url);
      node = node->GetNext();
   }

   return false;
}
Esempio n. 19
0
File: HelpCB.c Progetto: juddy/edcde
void
HelpHyperlinkCB(
        Widget w,
        caddr_t client_data,
        caddr_t call_data )
{
    DtHelpDialogCallbackStruct *pHyper = 
	    (DtHelpDialogCallbackStruct *) call_data;

    switch(pHyper->hyperType)
    {
	case DtHELP_LINK_JUMP_NEW:
	    DisplayHelp(pHyper->helpVolume, pHyper->locationId);
	    break;
	default:
            ;
	    /* application defined link code goes here */
    }
}
Esempio n. 20
0
/**********************************************************************
 * Function: SrcSelDlgProc
 * Info    : dialog event handler for source file selection
 * Result  : TRUE or FALSE
 **********************************************************************/
MRESULT EXPENTRY SrcSelDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{

 static PFILEDLG pFileDlg;
 MRESULT rc = FALSE;
 USHORT Val;

 switch (msg)
 {

   case WM_INITDLG:
      CenterWindow(hwnd);
      /* Get pointer to FILEDLG structure */
      pFileDlg = (PFILEDLG) WinQueryWindowULong(hwnd, QWL_USER);
    break;

   case WM_HELP:
     DisplayHelp(IDL_SRCFILE_HELP);
    break;

   case WM_COMMAND:
    switch(Val = SHORT1FROMMP(mp1))
    {
      case DID_APPLY_PB:
        if (NO_ERROR == CopyClipBoardData2TempFile())
        {
         pFileDlg->lReturn = DID_APPLY_PB;
         WinDismissDlg(hwnd, TRUE);
         return (MRESULT) TRUE;
        }
       break;
    }
    /* fall through for appropriate DID_OK handling by default windows proc!  */

   default:
     rc = WinDefFileDlgProc (hwnd, msg, mp1, mp2);
 }

 return rc;

}
Esempio n. 21
0
void CreateNewSession(int accDesc)
{
	char *message = "\n\nWelcome to the Traceroute server\n";
	int len = strlen(message);
	pthread_t pth;

	if (active_sessions == gMaxUsers)
	{
		WriteToLog("MAX_USERS reached, connection refused");
		message = "Server busy, please try again later...\n";
		len = strlen(message);
		send(accDesc,message,len,0);
		close(accDesc);
		return;
	}
	else
	{
		send(accDesc,message,len,0);
		DisplayHelp(accDesc);
		pthread_create(&pth,NULL,WaitForUserInput,(void *)(intptr_t)accDesc);
		active_sessions++;
	}
}
Esempio n. 22
0
void CCmdPlay::DoRunL()
	{
	if (iMaxVolume)
		{
		// we use DevSound to get the max volume, as CMdaAudioRecorderUtility
		// always returns 0 until we have opened a file.
		CMMFDevSound* devSound = CMMFDevSound::NewL();
		TInt maxVol = devSound->MaxVolume();
		TBool cons = Stdout().AttachedToConsole();
		if (cons) Printf(_L("Maximum volume: "));
		Printf(_L("%d"), maxVol);
		if (cons) Printf(_L("\r\n"));
		delete devSound;
		}
	else
		{
		if (!iArguments.IsPresent(0)) 
			{
			PrintError(KErrArgument, _L("No filename specified"));
			DisplayHelp();
			Complete(KErrArgument);
			return;
			}
		iPlayer->GetReady(iFile, iVerbose);
		if (iOptions.IsPresent(&iPriority) || iOptions.IsPresent(&iPreference))
			{
			iPlayer->SetPriority(iPriority, iPreference);
			}
		if (iOptions.IsPresent(&iVolume))
			{
			iPlayer->SetVolume(iVolume);
			}
		CActiveScheduler::Start();
		User::LeaveIfError(iPlayer->Error());
		}
	}
Esempio n. 23
0
////////////////////////////////////////////////////////////////////////////////
// onContents()
// onHelp()
//
//     Help menu options
void frmDebugger::OnContents(wxCommandEvent &event)
{
	DisplayHelp(wxT("debugger"), HELP_PGADMIN);
}
Esempio n. 24
0
void cOsdMenu::Display(void)
{
  if (subMenu) {
     subMenu->Display();
     return;
     }
  displayMenu->SetMessage(mtStatus, NULL);
  displayMenu->Clear();
  cStatus::MsgOsdClear();
#ifdef USE_GRAPHTFT
  cStatus::MsgOsdMenuDisplay(MenuKind());
#endif /* GRAPHTFT */

#ifdef REELVDR
  /* EnableSideNote here, before SetTitle() since
     SetTitle draws the SideNote-background */
  displayMenu->EnableSideNote(enableSideNote);
#endif

  if (menuCategory != displayMenu->MenuCategory())
     displayMenu->SetMenuCategory(menuCategory);
  displayMenuItems = displayMenu->MaxItems();
  displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX
  displayMenu->SetTitle(title);
  cStatus::MsgOsdTitle(title);
#ifdef REELVDR
  // No scrolling ONLY in Main Menu
  if (strcasestr(title, tr("Main Menu")))
      displayMenuItems = 20; //show atleast 6 icons (4 stop rec, 1 play DVD, 1 stop rec. replay) + 4  menu items in one screen without scrolling
  else
      displayMenuItems = displayMenu->MaxItems();
  // Enable SideNote Again since SetTitle() resets xItemLeft in skin
  // TODO XXX eliminate the need for second call to EnableSideNote()
  displayMenu->EnableSideNote(enableSideNote);
#endif
  DisplayHelp(true);
#ifdef REELVDR
  displayMenu->SetKeys(helpKeys);
#endif
  int count = Count();
  if (count > 0) {
     int ni = 0;
     for (cOsdItem *item = First(); item; item = Next(item)) {
         cStatus::MsgOsdItem(item->Text(), ni++);
         if (current < 0 && item->Selectable())
            current = item->Index();
         }
     if (current < 0)
        current = 0; // just for safety - there HAS to be a current item!
     first = min(first, max(0, count - displayMenuItems)); // in case the menu size has changed
     if (current - first >= displayMenuItems || current < first) {
        first = current - displayMenuItems / 2;
        if (first + displayMenuItems > count)
           first = count - displayMenuItems;
        if (first < 0)
           first = 0;
        }
     int i = first;
     int n = 0;
     for (cOsdItem *item = Get(first); item; item = Next(item)) {
         bool CurrentSelectable = (i == current) && item->Selectable();
         displayMenu->SetItem(item->Text(), i - first, CurrentSelectable, item->Selectable());
         if (CurrentSelectable)
            cStatus::MsgOsdCurrentItem(item->Text());
         if (++n == displayMenuItems)
            break;
         i++;
         }
     }
  displayMenu->SetScrollbar(count, first);
  if (!isempty(status))
     displayMenu->SetMessage(mtStatus, status);
}
Esempio n. 25
0
bool wxExtHelpController::KeywordSearch(const wxString& k,
                                   wxHelpSearchMode WXUNUSED(mode))
{
   if (! m_NumOfEntries)
      return false;

   wxString *choices = new wxString[m_NumOfEntries];
   wxString *urls = new wxString[m_NumOfEntries];

   int          idx = 0;
   bool         rc = false;
   bool         showAll = k.empty();

   wxList::compatibility_iterator node = m_MapList->GetFirst();

   {
        // display a busy cursor
        wxBusyCursor b;
        wxString compA, compB;
        wxExtHelpMapEntry *entry;

        // we compare case insensitive
        if (! showAll)
        {
            compA = k;
            compA.LowerCase();
        }

        while (node)
        {
            entry = (wxExtHelpMapEntry *)node->GetData();
            compB = entry->doc;

            bool testTarget = ! compB.empty();
            if (testTarget && ! showAll)
            {
                compB.LowerCase();
                testTarget = compB.Contains(compA);
            }

            if (testTarget)
            {
                urls[idx] = entry->url;
                // doesn't work:
                // choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR));
                //if (choices[idx].empty()) // didn't contain the ';'
                //   choices[idx] = (**i).doc;
                choices[idx] = wxEmptyString;
                for (int j=0; ; j++)
                {
                    wxChar targetChar = entry->doc.c_str()[j];
                    if ((targetChar == 0) || (targetChar == WXEXTHELP_COMMENTCHAR))
                        break;

                    choices[idx] << targetChar;
                }

                idx++;
            }

            node = node->GetNext();
        }
    }

    switch (idx)
    {
    case 0:
        wxMessageBox(_("No entries found."));
        break;

    case 1:
        rc = DisplayHelp(urls[0]);
        break;

    default:
        idx = wxGetSingleChoiceIndex(
            showAll ? _("Help Index") : _("Relevant entries:"),
            showAll ? _("Help Index") : _("Entries found"),
            idx, choices);
        if (idx >= 0)
            rc = DisplayHelp(urls[idx]);
        break;
    }

    delete [] urls;
    delete [] choices;

    return rc;
}
Esempio n. 26
0
File: main.c Progetto: kuailexs/jwm
/** The main entry point. */
int main(int argc, char *argv[])
{
   char *temp;
   int x;
   enum {
      ACTION_RUN,
      ACTION_RESTART,
      ACTION_EXIT,
      ACTION_RELOAD,
      ACTION_PARSE
   } action;

   StartDebug();

   /* Get the name of the user's local configuration file. */
   temp = getenv("HOME");
   if(temp) {
      const size_t temp_len = strlen(temp);
      const size_t config_len = sizeof(CONFIG_FILE);
      configPath = Allocate(temp_len + config_len);
      memcpy(configPath, temp, temp_len);
      memcpy(&configPath[temp_len], CONFIG_FILE, config_len);
   } else {
      configPath = CopyString(CONFIG_FILE);
   }

   /* Parse command line options. */
   action = ACTION_RUN;
   for(x = 1; x < argc; x++) {
      if(!strcmp(argv[x], "-v")) {
         DisplayAbout();
         DoExit(0);
      } else if(!strcmp(argv[x], "-h")) {
         DisplayHelp();
         DoExit(0);
      } else if(!strcmp(argv[x], "-p")) {
         action = ACTION_PARSE;
      } else if(!strcmp(argv[x], "-restart")) {
         action = ACTION_RESTART;
      } else if(!strcmp(argv[x], "-exit")) {
         action = ACTION_EXIT;
      } else if(!strcmp(argv[x], "-reload")) {
         action = ACTION_RELOAD;
      } else if(!strcmp(argv[x], "-display") && x + 1 < argc) {
         displayString = argv[++x];
      } else if(!strcmp(argv[x], "-f") && x + 1 < argc) {
         Release(configPath);
         configPath = CopyString(argv[++x]);
      } else {
         printf("unrecognized option: %s\n", argv[x]);
         DisplayHelp();
         DoExit(1);
      }
   }

   switch(action) {
   case ACTION_PARSE:
      Initialize();
      ParseConfig(configPath);
      DoExit(0);
   case ACTION_RESTART:
      SendRestart();
      DoExit(0);
   case ACTION_EXIT:
      SendExit();
      DoExit(0);
   case ACTION_RELOAD:
      SendReload();
      DoExit(0);
   default:
      break;
   }

#if defined(HAVE_SETLOCALE) && defined(ENABLE_NLS)
   setlocale(LC_ALL, "");
#endif
#ifdef HAVE_GETTEXT
   bindtextdomain("jwm", LOCALEDIR);
   textdomain("jwm");
#endif

   /* The main loop. */
   StartupConnection();
   do {

      isRestarting = shouldRestart;
      shouldExit = 0;
      shouldRestart = 0;
      shouldReload = 0;

      /* Prepare JWM components. */
      Initialize();

      /* Parse the configuration file. */
      ParseConfig(configPath);

      /* Start up the JWM components. */
      Startup();

      /* The main event loop. */
      EventLoop();

      /* Shutdown JWM components. */
      Shutdown();

      /* Perform any extra cleanup. */
      Destroy();

   } while(shouldRestart);
   ShutdownConnection();

   /* If we have a command to execute on shutdown, run it now. */
   if(exitCommand) {
      execl(SHELL_NAME, SHELL_NAME, "-c", exitCommand, NULL);
      Warning(_("exec failed: (%s) %s"), SHELL_NAME, exitCommand);
      DoExit(1);
   } else {
      DoExit(0);
   }

   /* Control shoud never get here. */
   return -1;

}
Esempio n. 27
0
void frmDebugger::OnHelp(wxCommandEvent &event)
{
	DisplayHelp(wxT("plpgsql"), HELP_POSTGRESQL);
}
Esempio n. 28
0
int ParseArgs(int argc, char *argv[], user_settings *set)
{
	if (argv == NULL || set == NULL)
		return USR_PTR_PASS_FAIL;

	if (argc < 2) {
		DisplayHelp(argv[0]);
		return USR_HELP;
	}

	// Detecting Help Requried
	for (int i = 1; i < argc; i++) {
		if (strcmp(argv[i], "-help") == 0) {
			DisplayHelp(argv[0]);
			return USR_HELP;
		}
		else if (strcmp(argv[i], "-exthelp") == 0) {
			DisplayExtendedHelp(argv[0]);
			return USR_HELP;
		}
	}

	// Allocating Memory for Content Path Ptrs
	set->common.contentPath = calloc(CIA_MAX_CONTENT, sizeof(char*));
	if (set->common.contentPath == NULL) {
		fprintf(stderr, "[SETTING ERROR] Not Enough Memory\n");
		return USR_MEM_ERROR;
	}

	// Initialise Keys
	InitKeys(&set->common.keys);

	// Setting Defaults
	SetDefaults(set);

	// Parsing Arguments
	int set_result;
	for (int i = 1; i < argc; i += set_result) {
		set_result = SetArgument(argc, i, argv, set);
		if (set_result < 1) {
			fprintf(stderr, "[RESULT] Invalid arguments, see '%s -help'\n", argv[0]);
			return set_result;
		}
	}

	// Checking arguments
	if ((set_result = CheckArgumentCombination(set)) != 0)
		return set_result;

	// Setting Keys
	if ((set_result = SetKeys(&set->common.keys)) != 0)
		return set_result;

	// Generating outpath if required
	if (!set->common.outFileName) {
		char *source_path = NULL;
		if (set->ncch.buildNcch0)
			source_path = set->common.rsfPath;
		else if (set->common.workingFileType == infile_ncsd || set->common.workingFileType == infile_cia || set->common.workingFileType == infile_srl)
			source_path = set->common.workingFilePath;
		else
			source_path = set->common.contentPath[0];
		set->common.outFileName_mallocd = true;
		set->common.outFileName = replace_filextention(source_path, GetOutputExtention(set->common.outFormat));
	}
	return 0;
}
Esempio n. 29
0
void BubbleHelper::Helper()
{
    // Wait until the BApplication becomes valid, in case
    // someone creates this as a global variable.
    while(!be_app_messenger.IsValid())
        snooze(200000);
    // wait a little longer, until the BApplication is really up to speed
    while(be_app->IsLaunching())
        snooze(200000);

    textwin=new BWindow(BRect(-100,-100,-50,-50),"",B_BORDERED_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL,
                B_NOT_MOVABLE|B_AVOID_FOCUS);

    textview=new BTextView(BRect(0,0,50,50),"",BRect(1,1,49,49),B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
    textview->MakeEditable(false);
    textview->MakeSelectable(false);
    textview->SetWordWrap(false);
    textview->SetLowColor(255,255,190);
    textview->SetViewColor(255,255,190);
    textview->SetHighColor(0,0,0);
    textwin->AddChild(textview);
    textwin->Run();
    textwin->Lock();
    textwin->Activate(false);
    rename_thread(textwin->Thread(),"bubble");
    textwin->Unlock();

    ulong delaycounter=0;
    BPoint lastwhere;

    while(be_app_messenger.IsValid())
    {
        BPoint where;
        ulong buttons;
        if(enabled)
        {
            if(textwin->Lock())
            {
                textview->GetMouse(&where,&buttons);
                textview->ConvertToScreen(&where);
                if(lastwhere!=where || buttons)
                {
                    delaycounter=0;
                }
                else
                {
                    // mouse didn't move
                    if(delaycounter++>5)
                    {
                        delaycounter=0;
                        // mouse didn't move for a while
                        BView *view=FindView(where);
                        char *text=NULL;
                        while(view && (text=GetHelp(view))==NULL)
                            view=view->Parent();
                        if(text)
                        {
                            DisplayHelp(text,where);
                            // wait until mouse moves out of view, or wait
                            // for timeout
                            long displaycounter=0;
                            BPoint where2;
                            long displaytime=max_c(20,strlen(text));
                            do
                            {
                                textwin->Unlock();
                                snooze(100000);
                                if(!textwin->Lock())
                                    goto end; //window is apparently gone
                                textview->GetMouse(&where2,&buttons);
                                textview->ConvertToScreen(&where2);
                            } while(!buttons && where2==where && (displaycounter++<displaytime));
                        
                            HideBubble();
                            do
                            {
                                textwin->Unlock();
                                snooze(100000);
                                if(!textwin->Lock())
                                    goto end; //window is apparently gone
                                textview->GetMouse(&where2,&buttons);
                                textview->ConvertToScreen(&where2);
                            } while(where2==where);
                        }
                    }
                }
                lastwhere=where;
                textwin->Unlock();
            }
        }
end:
        snooze(100000);
    }
    // (this thread normally gets killed by the destructor before arriving here)
}
Esempio n. 30
0
void frmExport::OnHelp(wxCommandEvent &ev)
{
    DisplayHelp(wxT("export"), HELP_PGADMIN);
}