Beispiel #1
0
FileBrowser::FileBrowser(
    const char* name, ButtonState* bs, const char* dir1, int r, int c,
    boolean u, int h, const char* d
) : StringBrowser(name, bs, r, c, u, h, d) {
    Init(dir1);
    UpdateStrings();
}
static void freqminus (GtkWidget *wid, GtkWidget *win)
{
    gCenterFreq -= gSpanFreq * 0.5;
    g_bSettingsChanged = true;
    UpdateStrings();
    gtk_widget_queue_draw(win);
}
static void refminus (GtkWidget *wid, GtkWidget *win)
{
    gRefLevel -= 10.0;
    g_bSettingsChanged = true;
    UpdateStrings();
    gtk_widget_queue_draw(win);
}
Beispiel #4
0
BOOL CALLBACK PropSheetProc(HWND hwnd, UINT msg, LPARAM lParam) {
  if (msg == PSCB_PRECREATE) {
    DLGTEMPLATE *pDlgTemplate = (DLGTEMPLATE*) lParam;
    pDlgTemplate->style |= WS_THICKFRAME;
  }
  else if (msg == PSCB_INITIALIZED) {
    g_cfgwnd = hwnd;
    SetWindowSubclass(g_cfgwnd, PropSheetWinProc, 0, 0);
    UpdateStrings();

    // Set new icon specifically for the taskbar and Alt+Tab, without changing window icon
    HICON taskbar_icon = LoadImage(g_hinst, L"taskbar_icon", IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
    SendMessage(g_cfgwnd, WM_SETICON, ICON_BIG, (LPARAM)taskbar_icon);

    // OK button replaces Cancel button
    SendMessage(g_cfgwnd, PSM_CANCELTOCLOSE, 0, 0);
    HWND cancel = GetDlgItem(g_cfgwnd, IDCANCEL);
    HWND ok = GetDlgItem(g_cfgwnd, IDOK);
    Button_Enable(cancel, TRUE); // Re-enable to enable escape key
    WINDOWPLACEMENT wndpl = { sizeof(WINDOWPLACEMENT) };
    GetWindowPlacement(cancel, &wndpl);
    SetWindowPlacement(ok, &wndpl);
    ShowWindow(cancel, SW_HIDE);

    HWND apply = GetDlgItem(g_cfgwnd, IDAPPLY);
    Button_SetText(apply, L""); // Remove text to remove it's shortcut (Alt+A in English)
  }
}
Beispiel #5
0
LRESULT CALLBACK PropSheetWinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
  LRESULT ret = DefSubclassProc(hwnd, msg, wParam, lParam);
  if (msg == WM_NCHITTEST && (ret == HTBOTTOM || ret == HTBOTTOMLEFT || ret == HTBOTTOMRIGHT || ret == HTLEFT || ret == HTTOPLEFT || ret == HTTOPRIGHT || ret == HTRIGHT || ret == HTTOP)) {
    ret = HTCAPTION;
  }
  else if (msg == WM_UPDATESETTINGS) {
    UpdateStrings();
    HWND page = PropSheet_GetCurrentPageHwnd(g_cfgwnd);
    SendMessage(page, WM_INITDIALOG, 0, 0);
    NMHDR pnmh = { g_cfgwnd, 0, PSN_SETACTIVE };
    SendMessage(page, WM_NOTIFY, 0, (LPARAM) &pnmh);
  }
  return ret;
}
Beispiel #6
0
void CPlayerSubresyncBar::ResetSubtitle()
{
	m_list.SetRedraw(FALSE);
	m_list.DeleteAllItems();

	if (m_mode == VOBSUB || m_mode == TEXTSUB) {
		TCHAR buff[32] = { 0 };

		int prevstart = INT_MIN;

		int nCount = (int)m_sts.GetCount();
		m_list.SetItemCount(nCount);

		for (int i = 0; i < nCount; i++) {
			m_subtimes[i].newstart = m_subtimes[i].orgstart;
			m_subtimes[i].newend = m_subtimes[i].orgend;

			FormatTime(i, buff, _countof(buff), 0, false);
			m_list.InsertItem(i, buff);
			m_list.SetItemText(i, COL_PREVSTART, buff);
			FormatTime(i, buff, _countof(buff), 0, true);
			m_list.SetItemText(i, COL_END, buff);
			m_list.SetItemText(i, COL_PREVEND, buff);

			if (prevstart > m_subtimes[i].orgstart) {
				m_list.SetItemData(i, (DWORD_PTR)TSEP);
			}
			prevstart = m_subtimes[i].orgstart;

			// Since all items in COL_START and COL_PREVSTART have the same text size,
			// we can compute it for the first element only so that it's faster.
			if (i == 0) {
				m_list.SetColumnWidth(COL_START, LVSCW_AUTOSIZE);
				m_list.SetColumnWidth(COL_PREVSTART, LVSCW_AUTOSIZE);
			}
		}

		UpdateStrings();
	}

	m_list.SetRedraw(TRUE);
	m_list.Invalidate();
	m_list.UpdateWindow();
}
Beispiel #7
0
boolean FileBrowser::SetDirectory(const char* path) {
    boolean successful = true;
    path = ValidDirectories(path);
    const char* normpath = Normalize(path);

    if (strcmp(normpath, lastpath) != 0) {
        char* newnormpath = fb_strdup(normpath);
        successful = dir->LoadDirectory(newnormpath);

        if (successful) {
            delete [] lastpath;
            lastpath = newnormpath;
            UpdateStrings();
        } else {
            delete [] newnormpath;
        }
    }
    return successful;
}
static gboolean TimerFunc() //Periodically check to see if sweep has completed
{
    if(g_waittimer>0)
    {
        g_waittimer--;
         if(g_waittimer==0) pthread_create(&sweepThread, &tattr,ThreadFunc,NULL);
        return true;
    }
   if(g_bDirty) //If trace data has updated, process the trace
   {
        pthread_join(sweepThread,NULL);
	usleep(10000);
        DrawAgain();
 	usleep(10000);
        UpdateStrings();
 	usleep(10000);
        g_bDirty = false;
        g_waittimer = 2;
    }

    return true;
}
Beispiel #9
0
BOOL CALLBACK PropSheetProc(HWND hwnd, UINT msg, LPARAM lParam) {
  if (msg == PSCB_PRECREATE) {
    DLGTEMPLATE *pDlgTemplate = (DLGTEMPLATE*) lParam;
    pDlgTemplate->style |= WS_THICKFRAME;
  }
  else if (msg == PSCB_INITIALIZED) {
    g_cfgwnd = hwnd;
    SetWindowSubclass(g_cfgwnd, PropSheetWinProc, 0, 0);
    UpdateStrings();

    // OK button replaces Cancel button
    SendMessage(g_cfgwnd, PSM_CANCELTOCLOSE, 0, 0);
    HWND cancel = GetDlgItem(g_cfgwnd, IDCANCEL);
    HWND ok = GetDlgItem(g_cfgwnd, IDOK);
    Button_Enable(cancel, TRUE); // Re-enable to enable escape key
    WINDOWPLACEMENT wndpl = { sizeof(WINDOWPLACEMENT) };
    GetWindowPlacement(cancel, &wndpl);
    SetWindowPlacement(ok, &wndpl);
    ShowWindow(cancel, SW_HIDE);

    HWND apply = GetDlgItem(g_cfgwnd, IDAPPLY);
    Button_SetText(apply, L""); // Remove text to remove it's shortcut (Alt+A in English)
  }
}
Beispiel #10
0
void FileBrowser::Update() {
    Perspective orig_p = *perspective;
    RereadDirectory();
    UpdateStrings();
    Adjust(orig_p);
}
static void spanminus (GtkWidget *wid, GtkWidget *win)
{
    gSpanFreq = SnapToSpan(gSpanFreq * 0.5);
    UpdateStrings();
    gtk_widget_queue_draw(win);
}
int main (int argc, char *argv[])
{
    r.x=0;
    r.y=0;
    r.width=510;
    r.height = 400;


    // ************************** Thread scheduling **************************88
    // Use round-robin scheduling on a low latency linux kernel.
    // Set application's threads to priority 50.
    // Set data collection thread to priority 99
    // Looks solid on Netbook
 
    pthread_attr_init(&tattr);
    pthread_attr_setschedpolicy(&tattr,SCHED_FIFO);

    pMyHound = new CMySignalHound();

    if(pMyHound->Initialize()) return -5;

    double myTemp = pMyHound->ReadTemperature();
    sprintf(debugstr,"Temp %.2f",myTemp);
    pMyHound->SetupForSweep();        //Set up for initial sweep

     pthread_create(&sweepThread, &tattr,ThreadFunc,NULL); //Begin initial sweep

  /* Initialize GTK+ */
  g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
  gtk_init (&argc, &argv);
  g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);

  /* Create the main window */
  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width (GTK_CONTAINER (win), 8);
  gtk_window_set_title (GTK_WINDOW (win), "Signal Hound");
  gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);
  gtk_widget_realize (win);
  g_signal_connect (win, "destroy", gtk_main_quit, NULL);

  /* Create a layout box with buttons */
  layout = (GtkLayout *) gtk_layout_new (NULL,NULL);
  gtk_layout_set_size(layout,640,410);
  gtk_container_add (GTK_CONTAINER (win), (GtkWidget *) layout);

  graticule = (GtkDrawingArea *) gtk_drawing_area_new();
  gtk_widget_set_size_request((GtkWidget *)graticule,510,400);
  gtk_layout_put ( layout, (GtkWidget *)graticule, 2, 2);



  gtk_signal_connect (GTK_OBJECT (graticule), "expose_event",
                      (GtkSignalFunc) expose_event, NULL);
  gtk_signal_connect (GTK_OBJECT(graticule),"configure_event",
                      (GtkSignalFunc) configure_event, NULL);

  gtk_widget_set_events ((GtkWidget *)graticule, GDK_EXPOSURE_MASK);



  gtk_widget_set_size_request(win,640,410);

  button = gtk_button_new_with_label("FREQ+");
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (freqplus), (gpointer) win);
  gtk_layout_put ( layout, button, 520, 10);

  button = gtk_button_new_with_label("FREQ-");
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (freqminus), (gpointer) win);
  gtk_layout_put ( layout, button, 572, 10);

  button = gtk_button_new_with_label("SPAN+");
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (spanplus), (gpointer) win);
  gtk_layout_put ( layout, button, 520, 110);

  button = gtk_button_new_with_label("SPAN-");
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (spanminus), (gpointer) win);
  gtk_layout_put ( layout, button, 572, 110);

  button = gtk_button_new_with_label("REF+");
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (refplus), (gpointer) win);
  gtk_layout_put ( layout, button, 520, 210);

  button = gtk_button_new_with_label("REF-");
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (refminus), (gpointer) win);
  gtk_layout_put ( layout, button, 572, 210);


  fbuf = gtk_text_buffer_new(NULL);
  rbuf = gtk_text_buffer_new(NULL);
  sbuf = gtk_text_buffer_new(NULL);
  bbuf = gtk_text_buffer_new(NULL);
  dbuf = gtk_text_buffer_new(NULL);

  textfreq = gtk_text_view_new();
  textspan = gtk_text_view_new();
  textreflvl = gtk_text_view_new();
  textRBW = gtk_text_view_new();
  textdebug = gtk_text_view_new();

  UpdateStrings();

  gtk_text_view_set_buffer((GtkTextView *)textfreq,fbuf);
  gtk_text_view_set_buffer((GtkTextView *)textspan,sbuf);
  gtk_text_view_set_buffer((GtkTextView *)textreflvl,rbuf);
  gtk_text_view_set_buffer((GtkTextView *)textRBW,bbuf);
  gtk_text_view_set_buffer((GtkTextView *)textdebug,dbuf);

  gtk_layout_put ( layout, textfreq, 520, 60);
  gtk_layout_put ( layout, textspan, 520, 160);
  gtk_layout_put ( layout, textreflvl, 520, 260);
  gtk_layout_put ( layout, textRBW, 520, 310);
  gtk_layout_put ( layout, textdebug, 520, 360);

  // pMyHound->m_settings.m_suppressImage = false; // if you want image rejection off...

  g_timeout_add(25,(GSourceFunc) TimerFunc,NULL);
    /* Enter the main loop */
  gtk_widget_show_all (win);
  gtk_main ();

delete pMyHound;
  return 0;
}
void MainScreen::InitializeScreen()
{
	UpdateStrings();

	// Text definitions for main buttons
	text_StartAGame.setFont(fonts->button);
	
	text_StartAGame.setCharacterSize(BUTTON1_TEXT_SIZE);
	text_StartAGame.setStyle(sf::Text::Bold);
	text_StartAGame.setPosition(BUTTON_MAIN_FIRST_LEFT+BUTTON1_TEXT_MARGIN, BUTTON_MAIN_STARTAGAME_TOP+BUTTON1_TEXT_MARGIN);

	text_Options.setFont(fonts->button);

	text_Options.setCharacterSize(BUTTON1_TEXT_SIZE);
	text_Options.setStyle(sf::Text::Bold);
	text_Options.setPosition(BUTTON_MAIN_FIRST_LEFT+BUTTON1_TEXT_MARGIN, BUTTON_MAIN_OPTIONS_TOP+BUTTON1_TEXT_MARGIN);

	text_Exit.setFont(fonts->button);
	
	text_Exit.setCharacterSize(BUTTON1_TEXT_SIZE);
	text_Exit.setStyle(sf::Text::Bold);
	text_Exit.setPosition(BUTTON_MAIN_FIRST_LEFT+BUTTON1_TEXT_MARGIN, BUTTON_MAIN_EXIT_TOP+BUTTON1_TEXT_MARGIN);

	text_Back.setFont(fonts->button);
	
	text_Back.setCharacterSize(BUTTON1_TEXT_SIZE);
	text_Back.setStyle(sf::Text::Bold);
	text_Back.setPosition(BUTTON_MAIN_FIRST_LEFT+BUTTON1_TEXT_MARGIN, BUTTON_MAIN_EXIT_TOP+BUTTON1_TEXT_MARGIN);

	// Text definitions for side buttons (Start a Game)
	text_SelectAScenario.setFont(fonts->button);
	
	text_SelectAScenario.setCharacterSize(BUTTON1_TEXT_SIZE);
	text_SelectAScenario.setStyle(sf::Text::Bold);
	text_SelectAScenario.setPosition(BUTTON_MAIN_SECOND_LEFT+BUTTON1_TEXT_MARGIN, BUTTON_MAIN_SCENARIO_TOP+BUTTON1_TEXT_MARGIN);

	text_RandomMatch.setFont(fonts->button);
	
	text_RandomMatch.setCharacterSize(BUTTON1_TEXT_SIZE);
	text_RandomMatch.setStyle(sf::Text::Bold);
	text_RandomMatch.setPosition(BUTTON_MAIN_SECOND_LEFT+BUTTON1_TEXT_MARGIN, BUTTON_MAIN_RANDOM_TOP+BUTTON1_TEXT_MARGIN);

	text_CustomMatch.setFont(fonts->button);
	
	text_CustomMatch.setCharacterSize(BUTTON1_TEXT_SIZE);
	text_CustomMatch.setStyle(sf::Text::Bold);
	text_CustomMatch.setPosition(BUTTON_MAIN_SECOND_LEFT+BUTTON1_TEXT_MARGIN, BUTTON_MAIN_CUSTOM_TOP+BUTTON1_TEXT_MARGIN);

	// Definitions for main buttons
	recButton_StartAGame.setSize(sf::Vector2f(BUTTON_MAIN_FIRST_WIDTH,BUTTON_MAIN_FIRST_HEIGHT));
	recButton_StartAGame.setPosition(BUTTON_MAIN_FIRST_LEFT,BUTTON_MAIN_STARTAGAME_TOP);
		
	recButton_Options.setSize(sf::Vector2f(BUTTON_MAIN_FIRST_WIDTH,BUTTON_MAIN_FIRST_HEIGHT));
	recButton_Options.setPosition(BUTTON_MAIN_FIRST_LEFT,BUTTON_MAIN_OPTIONS_TOP);
	
	recButton_Exit.setSize(sf::Vector2f(BUTTON_MAIN_FIRST_WIDTH,BUTTON_MAIN_FIRST_HEIGHT));
	recButton_Exit.setPosition(BUTTON_MAIN_FIRST_LEFT,BUTTON_MAIN_EXIT_TOP);	

	// Definitions for side buttons (Start a Game)
	recButton_Scenario.setSize(sf::Vector2f(BUTTON_MAIN_SECOND_WIDTH,BUTTON_MAIN_SECOND_HEIGHT));
	recButton_Scenario.setPosition(BUTTON_MAIN_SECOND_LEFT,BUTTON_MAIN_SCENARIO_TOP);

	recButton_Random.setSize(sf::Vector2f(BUTTON_MAIN_SECOND_WIDTH,BUTTON_MAIN_SECOND_HEIGHT));
	recButton_Random.setPosition(BUTTON_MAIN_SECOND_LEFT,BUTTON_MAIN_RANDOM_TOP);

	recButton_Custom.setSize(sf::Vector2f(BUTTON_MAIN_SECOND_WIDTH,BUTTON_MAIN_SECOND_HEIGHT));
	recButton_Custom.setPosition(BUTTON_MAIN_SECOND_LEFT,BUTTON_MAIN_CUSTOM_TOP);

	// Definitions for Language Options
	recButton_English.setSize(sf::Vector2f(BUTTON_LANG_WIDTH,BUTTON_LANG_HEIGHT));
	recButton_English.setPosition(BUTTON_LANG_LEFT,BUTTON_LANG_EN_TOP);

	recButton_Turkish.setSize(sf::Vector2f(BUTTON_LANG_WIDTH,BUTTON_LANG_HEIGHT));
	recButton_Turkish.setPosition(BUTTON_LANG_LEFT,BUTTON_LANG_TR_TOP);

	text_English.setFont(fonts->button);
	text_English.setString("English");
	text_English.setCharacterSize(BUTTON1_TEXT_SIZE/2.0);
	text_English.setStyle(sf::Text::Bold);
	text_English.setPosition(BUTTON_LANG_LEFT+BUTTON1_TEXT_MARGIN/2.0, BUTTON_LANG_EN_TOP+BUTTON1_TEXT_MARGIN/2.0);

	text_Turkish.setFont(fonts->button);
	text_Turkish.setString(L"Türkçe");
	text_Turkish.setCharacterSize(BUTTON1_TEXT_SIZE/2.0);
	text_Turkish.setStyle(sf::Text::Bold);
	text_Turkish.setPosition(BUTTON_LANG_LEFT+BUTTON1_TEXT_MARGIN/2.0, BUTTON_LANG_TR_TOP+BUTTON1_TEXT_MARGIN/2.0);
};
e_Window MainScreen::ControlMousePressed()
{
	if (event.mouseButton.button == sf::Mouse::Left)
	{
		x = event.mouseButton.x;
		y = event.mouseButton.y;
		if (x>BUTTON_MAIN_FIRST_LEFT && x<BUTTON_MAIN_FIRST_LEFT+BUTTON_MAIN_FIRST_WIDTH)
		{ // Left mouse button is pressed on one of the main buttons on the left.
			if (y>BUTTON_MAIN_STARTAGAME_TOP && y<BUTTON_MAIN_STARTAGAME_TOP+BUTTON_MAIN_FIRST_HEIGHT)
			{ // Left mouse button is pressed on the button named "Start a Game".
				recButton_StartAGame.setOutlineColor(BUTTON1_HOVERED_OUTSIDE_COLOR);
				recButton_StartAGame.setFillColor(BUTTON1_HOVERED_INSIDE_COLOR);
				startIsSelected=true;
			}
			else if (y>BUTTON_MAIN_EXIT_TOP && y<BUTTON_MAIN_EXIT_TOP+BUTTON_MAIN_FIRST_HEIGHT)
			{ // Left mouse button is pressed on the button named "Exit".
				if (startIsSelected)
				{ // The button is used as "Back" to the main screen.
					startIsSelected = false;
					return mainScreen;
				}
				else
				{
					if (RenderClosing())
						return exitSignal;
				}
			}
		}

		else if (startIsSelected && x>BUTTON_MAIN_SECOND_LEFT && x<BUTTON_MAIN_SECOND_LEFT+BUTTON_MAIN_SECOND_WIDTH)
		{ // Left mouse button is pressed on Select a Scenario or Random Match or Custom Match
			if (y>BUTTON_MAIN_SCENARIO_TOP && y<BUTTON_MAIN_SCENARIO_TOP+BUTTON_MAIN_SECOND_HEIGHT)
			{ // Left mouse button is pressed on Select a Scenario
				game->currentGameType = Scenario;
				return selectionScreen;
			}
			else if (y>BUTTON_MAIN_RANDOM_TOP && y<BUTTON_MAIN_RANDOM_TOP+BUTTON_MAIN_SECOND_HEIGHT)
			{ // Left mouse button is pressed on Random Match
				game->currentGameType = RandomMatch;
				return selectionScreen;
			}
			else if (y>BUTTON_MAIN_CUSTOM_TOP && y<BUTTON_MAIN_CUSTOM_TOP+BUTTON_MAIN_SECOND_HEIGHT)
			{ // Left mouse button is pressed on Custom Match
				game->currentGameType = CustomMatch;
				return selectionScreen;
			}
		}
		else if (x>BUTTON_LANG_LEFT && x<BUTTON_LANG_LEFT+BUTTON_LANG_WIDTH)
		{
			if (y>BUTTON_LANG_EN_TOP && y<BUTTON_LANG_EN_TOP+BUTTON_LANG_HEIGHT)
			{ // Left mouse button is pressed on English
				if (game->language->init_English())
					UpdateStrings();
			}
			else if (y>BUTTON_LANG_TR_TOP && y<BUTTON_LANG_TR_TOP+BUTTON_LANG_HEIGHT)
			{ // Left mouse button is pressed on Turkish
				if (game->language->init_Turkish())
					UpdateStrings();
			}
		}

	}

	return noChange;
}
Beispiel #15
0
BOOL BuildGUI(char *screenname) {

	Object **ar = Window_Objs;
  struct Screen *screen;
  BOOL OptionFrame = FALSE;
  LONG indicatorwidth = 100;
  Object *l1, *l2, *l3, *l4, *l5, *l6, *l7;

  UpdateStrings();

  if (ButtonBase == NULL) { /* force it open */
    Printf((char *) msgTextNoOpen, "button.gadget", __classactversion);
    Printf("\n");
    return FALSE;
  }

  /* Dynamic */
  unitlist      = ChooserLabelsA( (STRPTR *) Units);
  modelist      = BrowserNodesA( (STRPTR *) Modes);
  infolist      = BrowserNodes2(infotexts, infoargs);

  /* Static */
  pagelist      = ClickTabs( (char *) msgPageMode, (char *) msgPageAdvanced, NULL);
  debuglist     = ChooserLabels( (char *) msgDebugNone,
                                 (char *) msgDebugLow,
                                 (char *) msgDebugHigh,
                                 (char *) msgDebugFull,
                                 NULL);
  echolist      = ChooserLabels( (char *) msgEchoEnabled,
                                 (char *) msgEchoFast,
                                 (char *) msgEchoDisabled,
                                 NULL);
  surroundlist  = ChooserLabels( (char *) msgSurroundEnabled,
                                 (char *) msgSurroundDisabled,
                                 NULL);
  clipMVlist    = ChooserLabels( (char *) msgMVNoClip,
                                 (char *) msgMVClip,
                                 NULL);


  screen = LockPubScreen(screenname);

  vi = GetVisualInfoA(screen, NULL);

  Menu = CreateMenusA(NewMenus, NULL);

  if(vi == NULL || Menu == NULL) {
    Printf((char *) msgTextNoWindow);
    Printf("\n");
    return FALSE;
  }

  if(!LayoutMenus(Menu, vi, GTMN_NewLookMenus, TRUE, TAG_DONE)) {
    Printf((char *) msgTextNoWindow);
    Printf("\n");
    return FALSE;
  }

  indicatorwidth = max(indicatorwidth, 16 * screen->RastPort.Font->tf_XSize);
  if(screen->Height > 240) {
    OptionFrame = TRUE;
  }

  ar[ACTID_PAGE] = PageObject,
    PAGE_Current,         0,

/* PAGE 1 */
    PAGE_Add, HLayoutObject,
      LAYOUT_VertAlignment, LALIGN_CENTER,

      LAYOUT_AddChild, VLayoutObject,

        LAYOUT_AddChild, ar[ACTID_UNIT] = PopUpObject,
          CHOOSER_Labels,         unitlist,
          CHOOSER_Active,         state.UnitSelected,
        ChooserEnd,
        CHILD_WeightedHeight, 0,

        LAYOUT_AddChild, ar[ACTID_MODE] = ListBrowserObject,
          LISTBROWSER_Labels,     modelist,
          LISTBROWSER_MakeVisible,state.ModeSelected,
          LISTBROWSER_Selected,   state.ModeSelected,
          LISTBROWSER_ShowSelected,TRUE,
        ListBrowserEnd,

        LAYOUT_AddChild, ar[SHOWID_MODE] = ListBrowserObject,
          LISTBROWSER_Labels,     infolist,
          LISTBROWSER_ColumnInfo, (ULONG)&ci,
          LISTBROWSER_AutoFit,    TRUE,
          LISTBROWSER_VertSeparators, FALSE,
          GA_ReadOnly,            TRUE,
        ListBrowserEnd,
        CHILD_MaxHeight, screen->RastPort.Font->tf_YSize * 6 + 6, // UHH!!
      LayoutEnd,

      LAYOUT_AddChild, HLayoutObject,
        (OptionFrame ? LAYOUT_SpaceOuter   : TAG_IGNORE), TRUE,
        (OptionFrame ? LAYOUT_RightSpacing : TAG_IGNORE), 0,
        (OptionFrame ? LAYOUT_BevelStyle   : TAG_IGNORE), BVS_GROUP,
        (OptionFrame ? LAYOUT_Label        : TAG_IGNORE), (char *) msgOptions,

        LAYOUT_AddChild, VLayoutObject,

          LAYOUT_AddChild, l1 = HLayoutObject,
            LAYOUT_AddChild, ar[ACTID_FREQ] = SliderObject,
              SLIDER_Min,           0,
              SLIDER_Max,           state.Frequencies,
              SLIDER_Level,         state.FreqSelected,
              SLIDER_Orientation,   SORIENT_HORIZ,
              GA_UserData,            &GadgetHook,
            SliderEnd,
            CHILD_Label, LabelObject,
              LABEL_Text,             (char *) msgOptFrequency,
            LabelEnd,
            LAYOUT_AddChild, ar[SHOWID_FREQ] = ButtonObject,
              GA_Text,                getFreq(),
              GA_ReadOnly,            TRUE,
              BUTTON_BevelStyle,      BVS_NONE,
              BUTTON_Transparent,     TRUE,
              BUTTON_Justification,   BCJ_LEFT,
            ButtonEnd,
            CHILD_MinWidth,         indicatorwidth,
            CHILD_MaxWidth,         indicatorwidth,
          LayoutEnd,

          LAYOUT_AddChild, l2 = HLayoutObject,
            LAYOUT_AddChild, ar[ACTID_CHANNELS] = SliderObject,
              SLIDER_Min,           1,
              SLIDER_Max,           state.Channels,
              SLIDER_Level,         state.ChannelsSelected,
              SLIDER_Orientation,   SORIENT_HORIZ,
              GA_UserData,            &GadgetHook,
            SliderEnd,
            CHILD_Label, LabelObject,
              LABEL_Text,             (char *) msgOptChannels,
            LabelEnd,
            LAYOUT_AddChild, ar[SHOWID_CHANNELS] = ButtonObject,
              GA_Text,                getChannels(),
              GA_ReadOnly,            TRUE,
              BUTTON_BevelStyle,      BVS_NONE,
              BUTTON_Transparent,     TRUE,
              BUTTON_Justification,   BCJ_LEFT,
            ButtonEnd,
            CHILD_MinWidth,         indicatorwidth,
            CHILD_MaxWidth,         indicatorwidth,
          LayoutEnd,

          LAYOUT_AddChild, l3 = HLayoutObject,
            LAYOUT_AddChild, ar[ACTID_OUTVOL] = SliderObject,
              SLIDER_Min,           0,
              SLIDER_Max,           state.OutVols,
              SLIDER_Level,         state.OutVolSelected,
              SLIDER_Orientation,   SORIENT_HORIZ,
              GA_UserData,            &GadgetHook,
            SliderEnd,
            CHILD_Label, LabelObject,
              LABEL_Text,             (char *) msgOptVolume,
            LabelEnd,
            LAYOUT_AddChild, ar[SHOWID_OUTVOL] = ButtonObject,
              GA_Text,                getOutVol(),
              GA_ReadOnly,            TRUE,
              BUTTON_BevelStyle,      BVS_NONE,
              BUTTON_Transparent,     TRUE,
              BUTTON_Justification,   BCJ_LEFT,
            ButtonEnd,
            CHILD_MinWidth,         indicatorwidth,
            CHILD_MaxWidth,         indicatorwidth,
          LayoutEnd,

          LAYOUT_AddChild, l4 = HLayoutObject,
            LAYOUT_AddChild, ar[ACTID_MONVOL] = SliderObject,
              SLIDER_Min,           0,
              SLIDER_Max,           state.MonVols,
              SLIDER_Level,         state.MonVolSelected,
              SLIDER_Orientation,   SORIENT_HORIZ,
              GA_UserData,            &GadgetHook,
            SliderEnd,
            CHILD_Label, LabelObject,
              LABEL_Text,             (char *) msgOptMonitor,
            LabelEnd,
            LAYOUT_AddChild, ar[SHOWID_MONVOL] = ButtonObject,
              GA_Text,                getMonVol(),
              GA_ReadOnly,            TRUE,
              BUTTON_BevelStyle,      BVS_NONE,
              BUTTON_Transparent,     TRUE,
              BUTTON_Justification,   BCJ_LEFT,
            ButtonEnd,
            CHILD_MinWidth,         indicatorwidth,
            CHILD_MaxWidth,         indicatorwidth,
          LayoutEnd,

          LAYOUT_AddChild, l5 = HLayoutObject,
            LAYOUT_AddChild, ar[ACTID_GAIN] = SliderObject,
              SLIDER_Min,           0,
              SLIDER_Max,           state.Gains,
              SLIDER_Level,         state.GainSelected,
              SLIDER_Orientation,   SORIENT_HORIZ,
              GA_UserData,            &GadgetHook,
            SliderEnd,
            CHILD_Label, LabelObject,
              LABEL_Text,             (char *) msgOptGain,
            LabelEnd,
            LAYOUT_AddChild, ar[SHOWID_GAIN] = ButtonObject,
              GA_Text,                getGain(),
              GA_ReadOnly,            TRUE,
              BUTTON_BevelStyle,      BVS_NONE,
              BUTTON_Transparent,     TRUE,
              BUTTON_Justification,   BCJ_LEFT,
            ButtonEnd,
            CHILD_MinWidth,         indicatorwidth,
            CHILD_MaxWidth,         indicatorwidth,
          LayoutEnd,

          LAYOUT_AddChild, l6 = HLayoutObject,
            LAYOUT_AddChild, ar[ACTID_INPUT] = SliderObject,
              SLIDER_Min,           0,
              SLIDER_Max,           state.Inputs,
              SLIDER_Level,         state.InputSelected,
              SLIDER_Orientation,   SORIENT_HORIZ,
              GA_UserData,            &GadgetHook,
            SliderEnd,
            CHILD_Label, LabelObject,
              LABEL_Text,             (char *) msgOptInput,
            LabelEnd,
            LAYOUT_AddChild, ar[SHOWID_INPUT] = ButtonObject,
              GA_Text,                getInput(),
              GA_ReadOnly,            TRUE,
              BUTTON_BevelStyle,      BVS_NONE,
              BUTTON_Transparent,     TRUE,
              BUTTON_Justification,   BCJ_LEFT,
            ButtonEnd,
            CHILD_MinWidth,         indicatorwidth,
            CHILD_MaxWidth,         indicatorwidth,
          LayoutEnd,

          LAYOUT_AddChild, l7 = HLayoutObject,
            LAYOUT_AddChild, ar[ACTID_OUTPUT] = SliderObject,
              SLIDER_Min,           0,
              SLIDER_Max,           state.Outputs,
              SLIDER_Level,         state.OutputSelected,
              SLIDER_Orientation,   SORIENT_HORIZ,
              GA_UserData,            &GadgetHook,
            SliderEnd,
            CHILD_Label, LabelObject,
              LABEL_Text,             (char *) msgOptOutput,
            LabelEnd,
            LAYOUT_AddChild, ar[SHOWID_OUTPUT] = ButtonObject,
              GA_Text,                getOutput(),
              GA_ReadOnly,            TRUE,
              BUTTON_BevelStyle,      BVS_NONE,
              BUTTON_Transparent,     TRUE,
              BUTTON_Justification,   BCJ_LEFT,
            ButtonEnd,
            CHILD_MinWidth,         indicatorwidth,
            CHILD_MaxWidth,         indicatorwidth,
          LayoutEnd,

        LayoutEnd,

      LayoutEnd,
      CHILD_WeightedHeight, 0,

    LayoutEnd,

/* PAGE 2 */
    PAGE_Add, HLayoutObject,
      LAYOUT_VertAlignment, LALIGN_CENTER,
      LAYOUT_HorizAlignment,  LALIGN_CENTER,

      LAYOUT_AddChild, VLayoutObject,
        LAYOUT_SpaceOuter,      TRUE,
        LAYOUT_BevelStyle,      BVS_GROUP,
        LAYOUT_Label,           (char *) msgGlobalOptions,
        LAYOUT_VertAlignment, LALIGN_BOTTOM,

        LAYOUT_AddChild, ar[ACTID_DEBUG] = PopUpObject,
          CHOOSER_Labels,       debuglist,
          CHOOSER_Active,       globalprefs.ahigp_DebugLevel,
        ChooserEnd,
        CHILD_Label, LabelObject,
          LABEL_Text,             (char *) msgGlobOptDebugLevel,
        LabelEnd,

        LAYOUT_AddChild, ar[ACTID_ECHO] = PopUpObject,
          CHOOSER_Labels,       echolist,
          CHOOSER_Active,       (globalprefs.ahigp_DisableEcho ? 2 : 0) |
                                (globalprefs.ahigp_FastEcho    ? 1 : 0),
        ChooserEnd,
        CHILD_Label, LabelObject,
          LABEL_Text,             (char *) msgGlobOptEcho,
        LabelEnd,

        LAYOUT_AddChild, ar[ACTID_SURROUND] = PopUpObject,
          CHOOSER_Labels,       surroundlist,
          CHOOSER_Active,       globalprefs.ahigp_DisableSurround,
        ChooserEnd,
        CHILD_Label, LabelObject,
          LABEL_Text,             (char *) msgGlobOptSurround,
        LabelEnd,

        LAYOUT_AddChild, ar[ACTID_CLIPMV] = PopUpObject,
          CHOOSER_Labels,       clipMVlist,
          CHOOSER_Active,       globalprefs.ahigp_ClipMasterVolume,
        ChooserEnd,
        CHILD_Label, LabelObject,
          LABEL_Text,             (char *) msgGlobOptMasterVol,
        LabelEnd,

        LAYOUT_AddChild, ar[ACTID_CPULIMIT] = IntegerObject,
          INTEGER_MaxChars,       3,
          INTEGER_MinVisible,     3,
          INTEGER_Minimum,        0,
          INTEGER_Maximum,        100,
          INTEGER_Number,         (globalprefs.ahigp_MaxCPU * 100 + 32768) >> 16,
          INTEGER_Arrows,         TRUE,
        IntegerEnd,
        CHILD_Label, LabelObject,
          LABEL_Text,             (char *) msgGlobOptCPULimit,
         LabelEnd,

      LayoutEnd,
      CHILD_WeightedHeight, 0,
      CHILD_WeightedWidth, 0,
    LayoutEnd,

  PageEnd;

  if(ar[ACTID_PAGE] != NULL) {
    SetAttrs( l1, LAYOUT_AlignLabels, l2, TAG_DONE);
    SetAttrs( l2, LAYOUT_AlignLabels, l3, TAG_DONE);
    SetAttrs( l3, LAYOUT_AlignLabels, l4, TAG_DONE);
    SetAttrs( l4, LAYOUT_AlignLabels, l5, TAG_DONE);
    SetAttrs( l5, LAYOUT_AlignLabels, l6, TAG_DONE);
    SetAttrs( l6, LAYOUT_AlignLabels, l7, TAG_DONE);
    SetAttrs( l7, LAYOUT_AlignLabels, l1, TAG_DONE);
  }

  WO_Window = WindowObject,
    WA_PubScreen,           screen,
    WA_Title,               (char *) msgTextProgramName,
    WA_CloseGadget,         TRUE,
    WA_DepthGadget,         TRUE,
    WA_DragBar,             TRUE,
    WA_Activate,            TRUE,
    WA_SizeGadget,          TRUE,
    WA_SizeBBottom,         TRUE,
    WA_NewLookMenus,        TRUE,
    WA_InnerWidth,          800,
    WA_InnerHeight,         400,

    WINDOW_MenuStrip,       Menu,
    WINDOW_Position,        WPOS_CENTERSCREEN,
    WINDOW_GadgetUserData,  WGUD_HOOK,
    WINDOW_IDCMPHook,      &IDCMPhook,
    WINDOW_IDCMPHookBits,   IDCMP_RAWKEY,

    WINDOW_Layout, VLayoutObject,
      LAYOUT_SpaceOuter,    TRUE,
      LAYOUT_DeferLayout,   TRUE,
      

/* TABS */
      LAYOUT_AddChild, ar[LAYOUT_PAGE] = VLayoutObject,
        LAYOUT_AddChild, ar[ACTID_TABS] = ClickTabObject,
          CLICKTAB_Labels,      pagelist,
          CLICKTAB_Current,     0L,
          ICA_TARGET,           ar[ACTID_PAGE],
          ICA_MAP,              MapTab2Page,
        ClickTabEnd,

        LAYOUT_AddChild, ar[ACTID_PAGE],
      LayoutEnd,

/* BUTTONS */
      LAYOUT_AddChild, HLayoutObject,
        LAYOUT_EvenSize, TRUE,

        LAYOUT_AddChild, ar[ACTID_SAVE] = ButtonObject,
          GA_Text,              (char *) msgButtonSave,
        ButtonEnd,
        CHILD_WeightedHeight, 0,

        LAYOUT_AddChild, ar[ACTID_USE] = ButtonObject,
          GA_Text,              (char *) msgButtonUse,
        ButtonEnd,
        CHILD_WeightedHeight, 0,

        LAYOUT_AddChild, ar[ACTID_QUIT] = ButtonObject,
          GA_Text,              (char *) msgButtonCancel,
        ButtonEnd,
        CHILD_WeightedHeight, 0,

      LayoutEnd,
      CHILD_WeightedHeight, 0,

    LayoutEnd,
  WindowEnd;

  if(WO_Window) {
    int i;
    for(i = 0; i < ACTID_COUNT; i++) {
      if(Window_Objs[i] != NULL) {
        SetAttrs(Window_Objs[i], GA_ID,        i,
                                 GA_RelVerify, TRUE, 
                                 TAG_END);
      }
    }
    Window = (struct Window *) CA_OpenWindow(WO_Window);
  }

  if(screen) {
    UnlockPubScreen(NULL, screen);
  }

  if(Window == NULL) {
    Printf((char *) msgTextNoWindow);
    Printf("\n");
    return FALSE;
  }

  openreq = GetFileObject,
    GETFILE_RejectIcons,   TRUE,
    GETFILE_Drawer,        "SYS:Prefs/Presets",
  EndObject;

  savereq = GetFileObject,
    GETFILE_RejectIcons,   TRUE,
    GETFILE_Drawer,        "SYS:Prefs/Presets",
    GETFILE_DoSaveMode,    TRUE,
  EndObject;

  if((openreq == NULL) || (savereq == NULL)) {
    Printf((char *) msgTextNoFileRequester);
    Printf("\n");
    return FALSE;
  }

  // Update the checkmark for "Create Icons?"
  {
    struct Menu     *menu;
    struct MenuItem *item;

    menu = Menu;

    ClearMenuStrip(Window);

    item = FindMenuItem(ACTID_ICONS);

    if(item) {
      if(SaveIcons)
        item->Flags |= CHECKED;
      else
        item->Flags &= ~CHECKED;
    }
    ResetMenuStrip(Window, menu);
  }

  GUINewUnit();
  return TRUE;
}
Beispiel #16
0
//Update Params gets called if initializing an instrument and after modifying it
bool CHHMRInst::UpdateParams(bool reseting)
{
	//get the file id to be used
	GetPrivateProfileString(m_pName,FILE_ID,"",m_pID,sizeof(m_pID),m_szIniFile);

	//get the file location to save data at
	GetPrivateProfileString(m_pName,SAVE_LOC,"C:\\DATA\\HHMR01",m_szSaveLoc,sizeof(m_szSaveLoc),m_szIniFile);
	
	//get the DO_DUMP from the ini file
	m_bDoDump = GetPrivateProfileInt(m_pName,"DO_DUMP",0,m_szIniFile)==1;

//	Get the LOG_MII from the ini file
//	m_bLogMII = GetPrivateProfileInt(m_pName,"LOG_MII",1,m_szIniFile)==1;

	//get the LOG_FILTER from the ini file
	m_bLogFilter = GetPrivateProfileInt(m_pName,"LOG_FILTER",1,m_szIniFile)==1;

	//get the SLOWRESET from the ini file
	m_dSlowReset = GetPrivateProfileInt(m_pName,"SLOW_RESET",900,m_szIniFile);
	m_dSlowReset *= 1000;

	//get the port string from the ini file
	//if we are resetting and it has changed then we must unregister
	//and reregister
	char tempport[32];
	if (reseting) strcpy(tempport,m_pPort);
	bool portchange;
	GetPrivateProfileString(m_pName,PORT,"",m_pPort,sizeof(m_pPort),m_szIniFile);
	if (strcmp(tempport,m_pPort)==0)
		portchange = false;
	else
		portchange = true;

	//get the node string from the ini file
	//if we are resetting and it has changed then we must unregister
	//and reregister
	int tempnode;
	tempnode = m_iNode;
	bool nodechange;
	m_iNode = GetPrivateProfileInt(m_pName,NODE,-1,m_szIniFile);
	if (tempnode == m_iNode)
		nodechange = false;
	else
		nodechange = true;

	//get the maximum pause of this instrument
	int maxpause = GetPrivateProfileInt(m_pName,"MAXPAUSE",30000,m_szIniFile);
	if (maxpause < 0) maxpause = 0;
	m_iPauseMax = maxpause * 1000;

	//get the data cycle time
	m_dCycleInt = GetPrivateProfileInt(m_pName,"MAXCYCLE",1000,m_szIniFile);
	if (m_dCycleInt < 100) m_dCycleInt = 100;
	if (m_dCycleInt > 1000) m_dCycleInt = 1000;

	//m_dCommFail = 20;//should this be settable
	m_dCommFail = GetPrivateProfileInt(m_pName,"COMMFAIL",20,m_szIniFile);
	if (m_dCommFail <= 1) m_dCommFail = 20;

	//set to approximately 5 intervals
	m_dTimeOut = 10;
	
	//get the high voltage high limit
	m_dHighVoltH = GetPrivateProfileInt(m_pName,"HIGHVOLTH",2000,m_szIniFile);

	//get the high voltage low limit
	m_dHighVoltL = GetPrivateProfileInt(m_pName,"HIGHVOLTL",1000,m_szIniFile);

	//get the sigma threshold for starting a new data record
	char tempvalue[32];
	GetPrivateProfileString(m_pName,"SIGMATHRESH","5.00",tempvalue,sizeof(tempvalue),m_szIniFile);
	m_lSigmaThresh = atof(tempvalue)/10.0;

	//get the totals threshold for starting a new data record
	GetPrivateProfileString(m_pName,"REALSTHRESH","50.00",tempvalue,sizeof(tempvalue),m_szIniFile);
	m_lRealThresh = atof(tempvalue);

	//get the totals threshold for starting a new data record
	GetPrivateProfileString(m_pName,"TOTALSTHRESH","50.00",tempvalue,sizeof(tempvalue),m_szIniFile);
	m_lTotalThresh = atof(tempvalue);

	//get the totals threshold for starting a new data record
	GetPrivateProfileString(m_pName,"TOTALS1THRESH","50.00",tempvalue,sizeof(tempvalue),m_szIniFile);
	m_lTotal1Thresh = atof(tempvalue);

	//get the low totals threshold for starting a new data record
	GetPrivateProfileString(m_pName,"TOTALSLOWTHRESH","1.00",tempvalue,sizeof(tempvalue),m_szIniFile);
	m_lTotalLThresh = atof(tempvalue);

	//get the camera trigger type (should be Real or Totals)
	GetPrivateProfileString(m_pName,"CAMERA_TRIGGER_TYPE","RT1",m_cCameraRealorTotals,sizeof(m_cCameraRealorTotals),m_szIniFile);
	for (unsigned ui = 0; ui < strlen(m_cCameraRealorTotals); ui++) 
		m_cCameraRealorTotals[ui] = (char)toupper(m_cCameraRealorTotals[ui]);

	GetPrivateProfileString(m_pName,"CAMERA_PORT","NONE",tempvalue,sizeof(tempvalue),m_szIniFile);
	for (unsigned int j = 0; j < strlen(tempvalue); j++)
		tempvalue[j] = (char)toupper(tempvalue[j]);
	bool bCameraDo = (tempvalue[0] == 'P');

	SetCamera(reseting);

	//get the maximum number of datapoints to compress
	m_dMaxCompress = GetPrivateProfileInt(m_pName,"MAXCOMPRESS",25,m_szIniFile);

	//get the count time units
	m_dCountTimeUnit = GetPrivateProfileInt(m_pName,"COUNTTIMEUNIT",10,m_szIniFile);

	//get the count time exp
//	m_dCountTimeExp = GetPrivateProfileInt(m_pName,"COUNTTIMEEXP", 1, m_szIniFile);

	//get the high voltage set
	m_dHighV = GetPrivateProfileInt(m_pName,"HIGHV",1800,m_szIniFile);

	//get the gate width
	m_dGateWidth = GetPrivateProfileInt(m_pName,"GATEWIDTH",1800,m_szIniFile);

	//get the predelay
	char temp[8];
	GetPrivateProfileString(m_pName,"PREDELAY","1",temp,sizeof(temp),m_szIniFile);
	sscanf(temp,"%x",&m_dPreDelay);

	if (reseting)
	{
		UpdateStrings();
		m_pPropertySheet->SetLimits(
			m_lRealThresh,
			m_lTotalThresh,
			m_lTotal1Thresh,
			m_lTotalLThresh,
			m_lSigmaThresh,
			m_dMaxCompress,
			m_dCountTimeUnit,
//			m_dCountTimeExp,
			m_dHighV,
			m_dGateWidth,
			m_dPreDelay,
			m_dHighVoltH, m_dHighVoltL,
			m_cCameraRealorTotals,
//			m_lCameraThreshold,
			bCameraDo,
			m_pID);
		m_pModParams->OnModparamsReset();

		if (!m_bPause)
		{
			KillTimer(TIMER_TICK);
			SetTimer(TIMER_TICK,m_dCycleInt,NULL);
		}
		else
		{
			KillTimer(TIMER_PAUSE);
			SetTimer(TIMER_PAUSE,m_iPauseMax,NULL);
		}
	}
	return true;
}
Beispiel #17
0
bool CHHMRInst::CreateInstrument(void)
{
//	TRACE("CHHMRInst::CreateInstrument()\n");
//	ASSERT(m_pName != NULL);
//	ASSERT(m_pButton != NULL);

	BOOL result = FALSE;

	//find if port exists if it doesn't return false;
	if (!UpdateParams(false))
		return false;

	//char port[32];
	//bool bCameraDo = false;

	//create CHHMRInst object -- we won't actually have a window
	//the window will be in a non-modal dialog box 

	CString cs = AfxRegisterWndClass(NULL, NULL, NULL, NULL);

	result = CreateEx(
			0,               //DWORD dwExStyle, 
			(LPCTSTR)cs,     //LPCTSTR lpszClassName, 
			m_pName,         //LPCTSTR lpszWindowName, 
			0,               //DWORD dwStyle, 
			CRect(0,0,0,0),  //const RECT& rect, 
			NULL,            //CWnd* pParentWnd, 
			0                //UINT nID, 
			);

	bool bParallelPortSetupStatusOK = true;

	if (result) 
	{
		//HHMRs don't have bbm so don't display numeric
		//Don't care on the radix input....
		m_pButton->put_DisplayNumericString(VARIANT_FALSE,0);
		m_pButton->put_FaceColor(COLOR_PAUSE);
		m_pButton->put_Flash(VARIANT_FALSE);

		//no time flag status for HHMR

		//get the other flag status
		m_iFlagOthr = GetPrivateProfileInt(m_pName,FLAGOTHR,-1,m_szIniFile);
		if (m_iFlagOthr == 1)
			m_pButton->ShowIcon_Frown(VARIANT_TRUE);

		//get the comm flag status
		m_iFlagComm = GetPrivateProfileInt(m_pName,FLAGCOMM,-1,m_szIniFile);
		if (m_iFlagComm == 1)
			m_pButton->ShowIcon_Error(VARIANT_TRUE);

		//create each of the pages we'll need in the property sheet
		m_pSummaryPage     = new CHHMRSummary(IDD_HHMRSUMMARY, this);
		m_pDataStatus      = new CHHMRDataStat(IDD_HHMRDATASTATUS_PAGE, this);//m_szIniFile);
		m_pModParams       = new CHHMRModParam(IDD_HHMRMODPARAMS_PAGE,this);
		m_pLegend		   = new CLegend();
		m_pCamera		   = new CHHMRConfig2(IDD_HHMRCONFIG,this);

		//create the user interface dialog box for this instrument
		m_pPropertySheet   = new CHHMRPropertySheet(LPCTSTR(m_pName),this, m_szIniFile);

		m_pPropertySheet->AddPage(m_pSummaryPage);
		m_pPropertySheet->AddPage(m_pDataStatus);
		m_pPropertySheet->AddPage(m_pModParams);
		m_pPropertySheet->AddPage(m_pCamera);
		m_pPropertySheet->AddPage(m_pLegend);

		DWORD dwStyle = 
			WS_POPUP | WS_CAPTION | DS_MODALFRAME |
			WS_MINIMIZEBOX|WS_OVERLAPPED|WS_SYSMENU;

		m_pPropertySheet->Create(this,dwStyle,0);

		m_pPropertySheet->RestartAutoCloseTimer();

		m_pSummaryPage->SetPropertySheet(m_pPropertySheet);
		m_pDataStatus->SetPropertySheet(m_pPropertySheet);
		m_pModParams->SetPropertySheet((CHHMRPropertySheet*)m_pPropertySheet);
		m_pCamera->SetPropertySheet(m_pPropertySheet,false);

		//necessary because PropertySheet doesn't creat a page until 
		//  it needs to display it.  So force it to create them all
		for (int i = m_pPropertySheet->GetPageCount();i>=0;i--)
			m_pPropertySheet->SetActivePage(i-1);

		char szTemp[MAX_PATH];
		GetModuleFileName(AfxGetInstanceHandle(),szTemp,sizeof(szTemp));
		char *c = strrchr(szTemp,'\\');//find the last "\"
		*c = '\0';						//make it null
		strcat(szTemp,"\\");
		
		CString cTemp(szTemp);
		cTemp += m_pName;
		cTemp += ".rtf";
		if (_access(cTemp,4))
		{
			cTemp = szTemp;
			cTemp += "HHMR.rtf";
			if (_access(cTemp,4))
			{
				cTemp = 
				"Instrument Button Colors...\n"
				"GREEN_ICON\nNormal state.\n"
				"---------------------------\n"
				"YELLOW_ICON\nA command has been sent from MIC to the instrument and MIC is waiting for a response.\n"
				"---------------------------\n"
				"RED_ICON\nCommunications Failure! A command has been sent and resent but no acceptable response has been received back from the instrument.\n"
				"---------------------------\n"
				"WHITE_ICON\nFLASHING to previous color. The disk is full or the instrument has a failure which is causing data loss\n"
				"---------------------------\n"
				"GRAY_ICON\nMIC has been instructed not to talk to the instrument.  In all cases this state will eventuall revert to a normal operational state.\n"
				"===========================\n"
				"\n"
				"Instrument Button ICONs...\n"
				"SQUARE_ICON Square: One or more of the tabbed pages have a data item out of tolerance or a configuration mismatch.\n"
				"---------------------------\n"
				"CLOCK_ICON Clock: The difference between MIC's time and the instrument's time is greater than the user set tolerance.\n"
				"---------------------------\n"
				"FLAG_ICON Flag:  MIC has sent and resent a command with no acceptable response and consequently commanded a long break reset in an attempt to reinitialize the instrument or a Hard Checksum Error occurred.\n"
				"---------------------------\n"
				"BELL_ICON Bell: The instrument is currently reporting a \"Measurement Interval of Interest\" or equivalent.\n"	
				"---------------------------\n"
				"FACE_ICON Face: The instrument has reported either a power problem or a battery backed up memory problem.\n"	
				"---------------------------\n"
				"FLOPPY_ICON Floppy Disk & Flashing: MIC has stopped writing to disk and talking to the instrument.  This can be caused by the hard drive being too full, the maximum use of the hard drive set too low, or disk write failure.\n"
				"---------------------------\n"
				"SKULL_ICON Skull and Cross Bones: The instrument has repeatedly failed to respond to commands and long break resets.  MIC will attempt to reset it every 15 minutes or instrument is in a state which is causing DATA LOSS.\n"
				"---------------------------\n"
				"BOMB_ICON Bomb: Configuration Error.  MIC is not configured correctly. Edit the MIC.INI file or delete the instrument object and recreate it to correct this problem.\n";
			}
		}
		m_pLegend->SetText((LPSTR)LPCSTR(cTemp));


		UpdateStrings();

		//set the time to start data collecting 
		SetTimer(TIMER_PAUSE,m_iPauseMax,NULL);

		char port[32];
		bool bCameraDo = false;
		GetPrivateProfileString(m_pName,"CAMERA_PORT","NONE",port,sizeof(port),m_szIniFile);
		for (unsigned int ui = 0; ui < strlen(port); ui++)
				port[ui]=(char)toupper(port[ui]);

		m_pPropertySheet->SetLimits(
				m_lRealThresh,
				m_lTotalThresh,
				m_lTotal1Thresh,
				m_lTotalLThresh,
				m_lSigmaThresh,
				m_dMaxCompress,
				m_dCountTimeUnit,
//				m_dCountTimeExp,
				m_dHighV,
				m_dGateWidth,
				m_dPreDelay,
				m_dHighVoltH, m_dHighVoltL,
				m_cCameraRealorTotals,
//				m_lCameraThreshold,
				bCameraDo = (port[0] == 'P'),
				m_pID);

			//reset the mod params page
			m_pModParams->OnModparamsReset();

		m_dCurrent_State = 1000;
		m_dTick_Count = 0;
		m_dTickToInquire = 0;

		bParallelPortSetupStatusOK = SetupParallelPort(true);

		//register this instument with the com object 
		//note that the DIALOGBOX gets registered -- so that it will receive 
		//the data coming from the port.  We may want to change this to a 
		//separate CWndThread window later on if the interface gets sluggish

		VARIANT_BOOL vbResult;

		m_pComm->RegisterISO(
			(ULONG)m_pPropertySheet->m_hWnd,
			m_iNode,
			STANDARD_ISO,
			VARIANT_FALSE,  //not OOB
			&vbResult);

		m_bGoodRegister = (vbResult == VARIANT_TRUE);

		m_dRetransmit		= 0;		//no retransmitions yet
		m_dLongBreak		= 0;		//not in long break

		//SCR 118
		//EstablishVersionString();

		//tell the files that mic is starting for this instrument
		m_pPropertySheet->WriteToFile(
			TO_CEV | TO_PFM, 
			(m_bNormalShutdown)?TYPE_START:TYPE_ABNORMAL);

	}  //if(result)
	
	return (m_bGoodRegister && bParallelPortSetupStatusOK);
}
Beispiel #18
0
INT_PTR CALLBACK GeneralPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
  int updatestrings = 0;
  if (msg == WM_INITDIALOG) {
    wchar_t txt[20];
    GetPrivateProfileString(L"General", L"AutoFocus", L"0", txt, ARRAY_SIZE(txt), inipath);
    Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOFOCUS), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);

    GetPrivateProfileString(L"General", L"Aero", L"2", txt, ARRAY_SIZE(txt), inipath);
    Button_SetCheck(GetDlgItem(hwnd,IDC_AERO), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);

    GetPrivateProfileString(L"General", L"InactiveScroll", L"1", txt, ARRAY_SIZE(txt), inipath);
    Button_SetCheck(GetDlgItem(hwnd,IDC_INACTIVESCROLL), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);

    GetPrivateProfileString(L"General", L"MDI", L"0", txt, ARRAY_SIZE(txt), inipath);
    Button_SetCheck(GetDlgItem(hwnd,IDC_MDI), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);

    HWND control = GetDlgItem(hwnd, IDC_LANGUAGE);
    ComboBox_ResetContent(control);
    if (l10n == &l10n_ini) {
      ComboBox_AddString(control, l10n->lang);
      ComboBox_SetCurSel(control, 0);
      ComboBox_Enable(control, FALSE);
    }
    else {
      ComboBox_Enable(control, TRUE);
      int i;
      for (i=0; i < ARRAY_SIZE(languages); i++) {
        ComboBox_AddString(control, languages[i]->lang);
        if (l10n == languages[i]) {
          ComboBox_SetCurSel(control, i);
        }
      }
    }

    Button_Enable(GetDlgItem(hwnd,IDC_ELEVATE), vista && !elevated);
  }
  else if (msg == WM_COMMAND) {
    int id = LOWORD(wParam);
    int event = HIWORD(wParam);
    HWND control = GetDlgItem(hwnd, id);
    int val = Button_GetCheck(control);
    wchar_t txt[10];

    if (id == IDC_AUTOFOCUS) {
      WritePrivateProfileString(L"General", L"AutoFocus", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_AUTOSNAP && event == CBN_SELCHANGE) {
      val = ComboBox_GetCurSel(control);
      WritePrivateProfileString(L"General", L"AutoSnap", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_AERO) {
      WritePrivateProfileString(L"General", L"Aero", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_INACTIVESCROLL) {
      WritePrivateProfileString(L"General", L"InactiveScroll", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_MDI) {
      WritePrivateProfileString(L"General", L"MDI", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_LANGUAGE && event == CBN_SELCHANGE) {
      int i = ComboBox_GetCurSel(control);
      if (i == ARRAY_SIZE(languages)) {
        OpenUrl(L"https://stefansundin.github.io/altdrag/doc/translate.html");
        for (i=0; l10n != languages[i]; i++) {}
        ComboBox_SetCurSel(control, i);
      }
      else {
        l10n = languages[i];
        WritePrivateProfileString(L"General", L"Language", l10n->code, inipath);
        updatestrings = 1;
        UpdateStrings();
      }
    }
    else if (id == IDC_AUTOSTART) {
      SetAutostart(val, 0, 0);
      Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), val);
      Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), val && vista);
      if (!val) {
        Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), BST_UNCHECKED);
        Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), BST_UNCHECKED);
      }
    }
    else if (id == IDC_AUTOSTART_HIDE) {
      int elevate = Button_GetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE));
      SetAutostart(1, val, elevate);
    }
    else if (id == IDC_AUTOSTART_ELEVATE) {
      int hide = Button_GetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE));
      SetAutostart(1, hide, val);
      if (val) {
        // Don't nag if UAC is disabled, only check if elevated
        DWORD uac_enabled = 1;
        if (elevated) {
          DWORD len = sizeof(uac_enabled);
          HKEY key;
          RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_QUERY_VALUE, &key);
          RegQueryValueEx(key, L"EnableLUA", NULL, NULL, (LPBYTE)&uac_enabled, &len);
          RegCloseKey(key);
        }
        if (uac_enabled) {
          MessageBox(NULL, l10n->general_autostart_elevate_tip, APP_NAME, MB_ICONINFORMATION|MB_OK);
        }
      }
    }
    else if (id == IDC_ELEVATE && MessageBox(NULL,l10n->general_elevate_tip,APP_NAME,MB_ICONINFORMATION|MB_OK)) {
      wchar_t path[MAX_PATH];
      GetModuleFileName(NULL, path, ARRAY_SIZE(path));
      if ((INT_PTR)ShellExecute(NULL,L"runas",path,L"-config -multi",NULL,SW_SHOWNORMAL) > 32) {
        PostMessage(g_hwnd, WM_CLOSE, 0, 0);
      }
      else {
        MessageBox(NULL, l10n->general_elevation_aborted, APP_NAME, MB_ICONINFORMATION|MB_OK);
      }
      return;
    }
    UpdateSettings();
  }
  else if (msg == WM_NOTIFY) {
    LPNMHDR pnmh = (LPNMHDR) lParam;
    if (pnmh->code == PSN_SETACTIVE) {
      updatestrings = 1;

      // Autostart
      int autostart=0, hidden=0, elevated=0;
      CheckAutostart(&autostart, &hidden, &elevated);
      Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART), autostart?BST_CHECKED:BST_UNCHECKED);
      Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), hidden?BST_CHECKED:BST_UNCHECKED);
      Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), elevated?BST_CHECKED:BST_UNCHECKED);
      Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), autostart);
      Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), autostart && vista);
    }
  }
  if (updatestrings) {
    // Update text
    SetDlgItemText(hwnd, IDC_GENERAL_BOX,        l10n->general_box);
    SetDlgItemText(hwnd, IDC_AUTOFOCUS,          l10n->general_autofocus);
    SetDlgItemText(hwnd, IDC_AERO,               l10n->general_aero);
    SetDlgItemText(hwnd, IDC_INACTIVESCROLL,     l10n->general_inactivescroll);
    SetDlgItemText(hwnd, IDC_MDI,                l10n->general_mdi);
    SetDlgItemText(hwnd, IDC_AUTOSNAP_HEADER,    l10n->general_autosnap);
    SetDlgItemText(hwnd, IDC_LANGUAGE_HEADER,    l10n->general_language);
    SetDlgItemText(hwnd, IDC_AUTOSTART_BOX,      l10n->general_autostart_box);
    SetDlgItemText(hwnd, IDC_AUTOSTART,          l10n->general_autostart);
    SetDlgItemText(hwnd, IDC_AUTOSTART_HIDE,     l10n->general_autostart_hide);
    SetDlgItemText(hwnd, IDC_AUTOSTART_ELEVATE,  l10n->general_autostart_elevate);
    SetDlgItemText(hwnd, IDC_ELEVATE,            (elevated?l10n->general_elevated:l10n->general_elevate));
    SetDlgItemText(hwnd, IDC_AUTOSAVE,           l10n->general_autosave);

    // AutoSnap
    HWND control = GetDlgItem(hwnd, IDC_AUTOSNAP);
    ComboBox_ResetContent(control);
    ComboBox_AddString(control, l10n->general_autosnap0);
    ComboBox_AddString(control, l10n->general_autosnap1);
    ComboBox_AddString(control, l10n->general_autosnap2);
    ComboBox_AddString(control, l10n->general_autosnap3);
    wchar_t txt[10];
    GetPrivateProfileString(L"General", L"AutoSnap", L"0", txt, ARRAY_SIZE(txt), inipath);
    ComboBox_SetCurSel(control, _wtoi(txt));

    // Language
    control = GetDlgItem(hwnd, IDC_LANGUAGE);
    ComboBox_DeleteString(control, ARRAY_SIZE(languages));
    if (l10n == &en_US) {
      ComboBox_AddString(control, L"How can I help translate?");
    }
  }
  return FALSE;
}
Beispiel #19
0
BOOL BuildGUI(char *screenname)
{
  Object *MUISave, *MUIUse, *MUICancel;
  Object *page1,*page2;
  Object *MUITFreq,*MUITChannels,*MUITOutvol,*MUITMonvol,*MUITGain,*MUITInput,*MUITOutput,*MUITDebug,*MUITEcho,*MUITSurround,*MUITClipvol,*MUITCpu,*MUITACTime,*MUITScalemode;

  UpdateStrings();

  MUIMasterBase = (void *)OpenLibrary("muimaster.library", MUIMASTER_VLATEST);
  if(MUIMasterBase == NULL)
  {
    Printf((char *) msgTextNoOpen, (ULONG) "muimaster.library", MUIMASTER_VLATEST);
    Printf("\n");
    return FALSE;
  }

  page1 = HGroup,
    Child, VGroup,
      Child, MUIUnit = CycleObject,
        MUIA_CycleChain, 1,
        MUIA_Cycle_Entries, Units,
        MUIA_Cycle_Active, state.UnitSelected,
      End,
      Child, ListviewObject,
        MUIA_CycleChain, 1,
        MUIA_Listview_List, MUIList = ListObject,
          InputListFrame,
          MUIA_List_AutoVisible, TRUE,
        End,
      End,
      Child, HGroup,
        ReadListFrame,
        MUIA_Background, MUII_TextBack,
        Child, TextObject,
          MUIA_Text_Contents, msgProperties,
          MUIA_Text_SetMax, TRUE,
        End,
        Child, MUIInfos = TextObject,
          MUIA_Text_Contents, "\n\n\n\n\n\n",
          MUIA_Text_SetMin, FALSE,
        End,
      End,
    End,
    Child, BalanceObject,
    End,
    Child, VGroup,
      Child, HVSpace,
      Child, ColGroup(3),
        GroupFrameT(msgOptions),
        Child, MUITFreq = SpecialButton((STRPTR)msgOptFrequency),
        Child, MUIFreq = SpecialSlider(0,max(state.Frequencies-1,0),state.FreqSelected),
        Child, MUILFreq = SpecialLabel(getFreq()),
        Child, MUITChannels = SpecialButton((STRPTR)msgOptChannels),
        Child, MUIChannels = SpecialSlider(1,state.Channels,state.ChannelsSelected),
        Child, MUILChannels = SpecialLabel(getChannels()),
        Child, MUITOutvol = SpecialButton((STRPTR)msgOptVolume),
        Child, MUIOutvol = SpecialSlider(0,max(state.OutVols-1,0),state.OutVolSelected),
        Child, MUILOutvol = SpecialLabel(getOutVol()),
        Child, MUITMonvol = SpecialButton((STRPTR)msgOptMonitor),
        Child, MUIMonvol = SpecialSlider(0,max(state.MonVols-1,1),state.MonVolSelected),
        Child, MUILMonvol = SpecialLabel(getMonVol()),
        Child, MUITGain = SpecialButton((STRPTR)msgOptGain),
        Child, MUIGain = SpecialSlider(0,max(state.Gains-1,0),state.GainSelected),
        Child, MUILGain = SpecialLabel(getGain()),
        Child, MUITInput = SpecialButton((STRPTR)msgOptInput),
        Child, MUIInput = SpecialSlider(0,max(state.Inputs-1,0),state.InputSelected),
        Child, MUILInput = SpecialLabel(getInput()),
        Child, MUITOutput = SpecialButton((STRPTR)msgOptOutput),
        Child, MUIOutput = SpecialSlider(0,max(state.Outputs-1,0),state.OutputSelected),
        Child, MUILOutput = SpecialLabel(getOutput()),
      End,
      Child, MUIPlay = SimpleButton(msgButtonPlay),
      Child, HVSpace,
    End,
  End;

  page2 = VGroup,
    Child, HVSpace,
    Child, HGroup,
      Child, HVSpace,
      Child, ColGroup(2),
        GroupFrameT(msgGlobalOptions),
        Child, MUITDebug = SpecialButton((STRPTR)msgGlobOptDebugLevel),
        Child, MUIDebug = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, DebugLabels,
          MUIA_Cycle_Active, globalprefs.ahigp_DebugLevel,
        End,
        Child, MUITEcho = SpecialButton((STRPTR)msgGlobOptEcho),
        Child, MUIEcho  = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, EchoLabels,
          MUIA_Cycle_Active, (globalprefs.ahigp_DisableEcho ? 2 : 0) | (globalprefs.ahigp_FastEcho ? 1 : 0),
          MUIA_Disabled, AHIBase->lib_Version >= 5,
        End,
        Child, MUITSurround = SpecialButton((STRPTR)msgGlobOptSurround),
        Child, MUISurround = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, SurroundLabels,
          MUIA_Cycle_Active, globalprefs.ahigp_DisableSurround,
          MUIA_Disabled, AHIBase->lib_Version >= 5,
        End,
        Child, MUITClipvol = SpecialButton((STRPTR)msgGlobOptMasterVol),
        Child, MUIClipvol = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, ClipMVLabels,
          MUIA_Cycle_Active, globalprefs.ahigp_ClipMasterVolume,
          MUIA_Disabled, AHIBase->lib_Version >= 5,
        End,
        Child, MUITCpu = SpecialButton((STRPTR)msgGlobOptCPULimit),
        Child, MUICpu = SliderObject,
          MUIA_CycleChain, 1,
          MUIA_Slider_Horiz, TRUE,
          MUIA_Numeric_Min, 0,
          MUIA_Numeric_Max, 100,
          MUIA_Numeric_Value,(globalprefs.ahigp_MaxCPU * 100 + 32768) / 65536,
          MUIA_Numeric_Format,"%ld%%",
        End,
        Child, MUITACTime = SpecialButton((STRPTR)msgGlobOptACTime),
        Child, MUIACTime = SliderObject,
          MUIA_CycleChain, 1,
          MUIA_Slider_Horiz, TRUE,
          MUIA_Numeric_Min, 0,
          MUIA_Numeric_Max, 100,
          MUIA_Numeric_Value,(globalprefs.ahigp_AntiClickTime * 1000 + 32768) >> 16,
          MUIA_Numeric_Format,"%ld ms",
          MUIA_Disabled, AHIBase->lib_Version <= 4,
        End,
        Child, MUITScalemode = SpecialButton((STRPTR)msgOptScalemode),
        Child, MUIScalemode = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, ScaleLabels,
          MUIA_Cycle_Active, globalprefs.ahigp_ScaleMode,
          MUIA_Disabled, AHIBase->lib_Version <= 4,
        End,
      End,
      Child, HVSpace,
    End,
    Child, HVSpace,
  End;

  MUIApp = ApplicationObject,
    MUIA_Application_Title, (char *) msgTextProgramName,
    MUIA_Application_Version, Version,
    MUIA_Application_Copyright, "©1996-2004 Martin Blom",
    MUIA_Application_Author, "Stéphane Barbaray/Martin Blom",
    MUIA_Application_Base, "AHI",
    MUIA_Application_HelpFile, HELPFILE,
    MUIA_Application_Menustrip, MUIMenu = MUI_MakeObject(MUIO_MenustripNM,Menus,0),
    MUIA_Application_SingleTask, TRUE,
    SubWindow, MUIWindow = WindowObject,
      MUIA_Window_Title, (char *) msgTextProgramName,
      MUIA_Window_ID   , MAKE_ID('M','A','I','N'),
      MUIA_HelpNode, "AHI",
      WindowContents, VGroup,
       Child, RegisterGroup(PageNames),
         MUIA_CycleChain, 1,
         Child, page1,
         Child, page2,
       End,
       Child, HGroup,
          Child, MUISave = SimpleButton(msgButtonSave),
          Child, MUIUse = SimpleButton(msgButtonUse),
          Child, MUICancel = SimpleButton(msgButtonCancel),
        End,
      End,
    End,
  End;
  
  if( MUIApp != NULL )
  {
    APTR item = (APTR)DoMethod(MUIMenu,MUIM_FindUData,ACTID_ICONS);
    if(item)
    {
      set(item, MUIA_Menuitem_Checked, SaveIcons);
    }
    DoMethod(MUIWindow, MUIM_MultiSet, MUIA_Text_PreParse,"\033l",MUILFreq,MUILChannels,MUILOutvol,MUILMonvol,MUILGain,MUILInput,MUILOutput,NULL);
    DoMethod(MUIWindow, MUIM_MultiSet, MUIA_CycleChain, 1, MUISave,MUIUse,MUICancel,NULL);

    DoMethod(MUITFreq, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIFreq);
    DoMethod(MUITChannels, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIChannels);
    DoMethod(MUITOutvol, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIOutvol);
    DoMethod(MUITMonvol, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIMonvol);
    DoMethod(MUITGain, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIGain);
    DoMethod(MUITInput, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIInput);
    DoMethod(MUITOutput, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIOutput);
    DoMethod(MUIPlay, MUIM_Notify, MUIA_Pressed, FALSE, MUIApp, 2, MUIM_Application_ReturnID, ACTID_PLAY);
    DoMethod(MUITDebug, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIDebug);
    DoMethod(MUITEcho, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIEcho);
    DoMethod(MUITSurround, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUISurround);
    DoMethod(MUITClipvol, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIClipvol);
    DoMethod(MUITCpu, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUICpu);
    DoMethod(MUITACTime, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIACTime);
    DoMethod(MUITScalemode, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIScalemode);

    DoMethod(MUIWindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, MUIApp, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
    DoMethod(MUISave, MUIM_Notify, MUIA_Pressed, FALSE, MUIApp, 2, MUIM_Application_ReturnID, ACTID_SAVE);
    DoMethod(MUIUse, MUIM_Notify, MUIA_Pressed, FALSE, MUIApp, 2, MUIM_Application_ReturnID, ACTID_USE);
    DoMethod(MUICancel, MUIM_Notify, MUIA_Pressed, FALSE, MUIApp, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
    DoMethod(MUIUnit, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID, ACTID_UNIT);
    DoMethod(MUIList, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID, ACTID_MODE);
    DoMethod(MUIDebug, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_DEBUG);
    DoMethod(MUISurround, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_SURROUND);
    DoMethod(MUIEcho, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_ECHO);
    DoMethod(MUICpu, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_CPULIMIT);
    DoMethod(MUIClipvol, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_CLIPMV);
    DoMethod(MUIACTime, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_ACTIME);
    DoMethod(MUIScalemode, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_SCALEMODE);
    DoMethod(MUIFreq, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIChannels, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIOutvol, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIMonvol, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIGain, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIInput, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIOutput, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    set(MUIWindow, MUIA_Window_Open, TRUE);
    GUINewUnit();
    return TRUE;
  }
  return FALSE;
}
Beispiel #20
0
BOOL BuildGUI(char *screenname) {
	Object **ar = Window_Objs;
  struct Screen *screen;
  BOOL OptionFrame = FALSE;
  LONG indicatorwidth = 100;

  UpdateStrings();

  // Kludge for Piccaso 96/BGUI.
  if(FindTask("Picasso96"))
  {
    PopUpMenus = FALSE;
  }

  BGUIBase = (void *)OpenLibrary("bgui.library", 41);
  if(BGUIBase == NULL) {
    Printf((char *) msgTextNoOpen, (ULONG) "bgui.library", 41);
    Printf("\n");
    return FALSE;
  }

  screen = LockPubScreen(screenname);

  indicatorwidth = max(indicatorwidth, 16 * screen->RastPort.Font->tf_XSize);
  if(screen->Height > 240) {
    OptionFrame = TRUE;
  }

  WO_Window = WindowObject,
    WINDOW_PubScreen,       screen,
    WINDOW_Title,           (char *) msgTextProgramName,
    WINDOW_CloseGadget,     FALSE,
    WINDOW_MenuStrip,       Menus,
    WINDOW_AutoAspect,      TRUE,
    WINDOW_AutoKeyLabel,    TRUE,
    WINDOW_ScaleWidth,      60,
    WINDOW_ScaleHeight,     20,
    WINDOW_HelpFile,        HELPFILE,
    WINDOW_HelpNode,        "AHI",
    WINDOW_IDCMPHook,      &IDCMPhook,
    WINDOW_IDCMPHookBits,   IDCMP_RAWKEY,

    WINDOW_MasterGroup, VGroupObject, NormalOffset,

/* TABS */

      StartMember, ar[ACTID_TABS] = MxObject,
        MX_Labels, PageNames,
        MX_TabsObject, TRUE,
        GA_ID, ACTID_TABS,
      EndObject, FixMinHeight, EndMember,

      StartMember, ar[ACTID_PAGE] = PageObject, NormalSpacing, 
        PAGE_NoBufferRP, TRUE,

/* PAGE 1 */

        PageMember, HGroupObject, NormalOffset, NormalSpacing, TabAboveFrame,

          StartMember, vgroup = VGroupObject, NormalSpacing,

            StartMember, ar[ACTID_UNIT] = CycleObject,
              CYC_Labels,    Units,
              CYC_Active,    state.UnitSelected,
              CYC_PopActive, PopUpMenus,
              CYC_Popup,     PopUpMenus,
              GA_ID,         ACTID_UNIT,
            EndObject, FixMinHeight, EndMember,

            StartMember, ar[ACTID_MODE] = ListviewObject,
//              LISTV_EntryArray,  Modes,
//              LISTV_Select,      state.ModeSelected,
              PGA_NewLook, TRUE,
              GA_ID, ACTID_MODE,
            EndObject, EndMember,

            StartMember, HGroupObject,
              ButtonFrame, FRM_Flags, FRF_RECESSED,
          
              StartMember, InfoObject,
                INFO_TextFormat,  (char *) msgProperties,
                INFO_FixTextWidth,TRUE,
                INFO_MinLines,    6,
              EndObject, FixMinWidth, EndMember,

              StartMember, ar[SHOWID_MODE] = InfoObject,
                INFO_MinLines,   6,
              EndObject,  EndMember,
            EndObject, FixMinHeight, EndMember,

          EndObject /* vgroup */, EndMember,

          StartMember, VGroupObject, NormalSpacing, 

            VarSpace(1),

            StartMember, VGroupObject,
              (OptionFrame ? GROUP_HorizOffset : TAG_IGNORE), GRSPACE_NORMAL,
              (OptionFrame ? GROUP_VertOffset  : TAG_IGNORE), GRSPACE_NORMAL,
              (OptionFrame ? GROUP_Spacing     : TAG_IGNORE), GRSPACE_NORMAL,
              (OptionFrame ? FRM_Type          : TAG_IGNORE), FRTYPE_RIDGE,
              (OptionFrame ? FRM_Flags         : TAG_IGNORE), FRF_RECESSED,
              (OptionFrame ? FRM_Title         : TAG_IGNORE), (char *) msgOptions,

              StartMember, HGroupObject,
                StartMember, ar[ACTID_FREQ] = SliderObject,
                  LAB_Label,    (char *) msgOptFrequency,
                  SLIDER_Min,   0,
                  SLIDER_Max,   state.Frequencies -1 ,
                  SLIDER_Level, state.FreqSelected,
                  PGA_NewLook, TRUE,
                  GA_ID, ACTID_FREQ,
                EndObject, EndMember,

                StartMember, ar[SHOWID_FREQ] = InfoObject,
                  INFO_TextFormat,    getFreq(),
                  INFO_VertOffset,    0,
                EndObject, FixWidth(indicatorwidth), EndMember,
              EndObject, FixMinHeight, EndMember,

              StartMember, HGroupObject,
                StartMember, ar[ACTID_CHANNELS] = SliderObject,
                  LAB_Label,    (char *) msgOptChannels,
                  SLIDER_Min,   1,
                  SLIDER_Max,   state.Channels,
                  SLIDER_Level, state.ChannelsSelected,
                  PGA_NewLook, TRUE,
                  GA_ID, ACTID_CHANNELS,
                EndObject, EndMember,

                StartMember, ar[SHOWID_CHANNELS] = InfoObject,
                  INFO_TextFormat,    getChannels(),
                  INFO_VertOffset,    0,
                EndObject, FixWidth(indicatorwidth), EndMember,
              EndObject, FixMinHeight, EndMember,

              StartMember, HGroupObject,
                StartMember, ar[ACTID_OUTVOL] = SliderObject,
                  LAB_Label,    (char *) msgOptVolume,
                  SLIDER_Min,   0,
                  SLIDER_Max,   state.OutVols-1 ,
                  SLIDER_Level, state.OutVolSelected,
                  PGA_NewLook, TRUE,
                  GA_ID, ACTID_OUTVOL,
                EndObject, EndMember,

                StartMember, ar[SHOWID_OUTVOL] = InfoObject,
                  INFO_TextFormat,    getOutVol(),
                  INFO_VertOffset,    0,
                EndObject, FixWidth(indicatorwidth), EndMember,
              EndObject, FixMinHeight, EndMember,

              StartMember, HGroupObject,
                StartMember, ar[ACTID_MONVOL] = SliderObject,
                  LAB_Label,    (char *) msgOptMonitor,
                  SLIDER_Min,   0,
                  SLIDER_Max,   state.MonVols-1 ,
                  SLIDER_Level, state.MonVolSelected,
                  PGA_NewLook, TRUE,
                  GA_ID, ACTID_MONVOL,
                EndObject, EndMember,

                StartMember, ar[SHOWID_MONVOL] = InfoObject,
                  INFO_TextFormat,    getMonVol(),
                  INFO_VertOffset,    0,
                EndObject, FixWidth(indicatorwidth), EndMember,
              EndObject, FixMinHeight, EndMember,

              StartMember, HGroupObject,
                StartMember, ar[ACTID_GAIN] = SliderObject,
                  LAB_Label,    (char *) msgOptGain,
                  SLIDER_Min,   0,
                  SLIDER_Max,   state.Gains-1 ,
                  SLIDER_Level, state.GainSelected,
                  PGA_NewLook, TRUE,
                  GA_ID, ACTID_GAIN,
                EndObject, EndMember,

                StartMember, ar[SHOWID_GAIN] = InfoObject,
                  INFO_TextFormat,    getGain(),
                  INFO_VertOffset,    0,
                EndObject, FixWidth(indicatorwidth), EndMember,
              EndObject, FixMinHeight, EndMember,

              StartMember, HGroupObject,
                StartMember, ar[ACTID_INPUT] = SliderObject,
                  LAB_Label,    (char *) msgOptInput,
                  SLIDER_Min,   0,
                  SLIDER_Max,   state.Inputs-1 ,
                  SLIDER_Level, state.InputSelected,
                  PGA_NewLook, TRUE,
                  GA_ID, ACTID_INPUT,
                EndObject, EndMember,

                StartMember, ar[SHOWID_INPUT] = InfoObject,
                  INFO_TextFormat,    getInput(),
                  INFO_VertOffset,    0,
                EndObject, FixWidth(indicatorwidth), EndMember,
              EndObject, FixMinHeight, EndMember,

              StartMember, HGroupObject,
                StartMember, ar[ACTID_OUTPUT] = SliderObject,
                  LAB_Label,    (char *) msgOptOutput,
                  SLIDER_Min,   0,
                  SLIDER_Max,   state.Outputs-1 ,
                  SLIDER_Level, state.OutputSelected,
                  PGA_NewLook, TRUE,
                  GA_ID, ACTID_OUTPUT,
                EndObject, EndMember,

                StartMember, ar[SHOWID_OUTPUT] = InfoObject,
                  INFO_TextFormat,    getOutput(),
                  INFO_VertOffset,    0,
                EndObject, FixWidth(indicatorwidth), EndMember,
              EndObject, FixMinHeight, EndMember,

            EndObject /* vgroup "Options" */, FixMinHeight, EndMember,

          VarSpace(1),

          EndObject /* vgroup */, EndMember,

        EndObject, /* (EndMember) page */

/* PAGE 2 */

        PageMember, HGroupObject, NormalSpacing, TabAboveFrame,

          VarSpace(1),

          StartMember, VGroupObject, NormalSpacing,

            VarSpace(1), 

            StartMember, VGroupObject, NormalOffset, NormalSpacing,
              RidgeFrame, FRM_Flags, FRF_RECESSED, FrameTitle((char *) msgGlobalOptions),

              StartMember, HGroupObject, NormalSpacing,
              StartMember, VGroupObject, NormalSpacing,

              StartMember, ar[ACTID_DEBUG] = CycleObject,
                LAB_Label,      (char *) msgGlobOptDebugLevel,
                LAB_Place,      PLACE_LEFT,
                CYC_Labels,     DebugLabels,
                CYC_Active,     globalprefs.ahigp_DebugLevel,
                CYC_PopActive,  PopUpMenus,
                CYC_Popup,      PopUpMenus,
                GA_ID,          ACTID_DEBUG,
              EndObject, FixMinHeight, EndMember,

              StartMember, ar[ACTID_ECHO] = CycleObject,
                LAB_Label,      (char *) msgGlobOptEcho,
                LAB_Place,      PLACE_LEFT,
                CYC_Labels,     EchoLabels,
                CYC_Active,     (globalprefs.ahigp_DisableEcho ? 2 : 0) |
                                (globalprefs.ahigp_FastEcho    ? 1 : 0),
                CYC_PopActive,  PopUpMenus,
                CYC_Popup,      PopUpMenus,
                GA_ID,          ACTID_ECHO,
              EndObject, FixMinHeight, EndMember,

              StartMember, ar[ACTID_SURROUND] = CycleObject,
                LAB_Label,      (char *) msgGlobOptSurround,
                LAB_Place,      PLACE_LEFT,
                CYC_Labels,     SurroundLabels,
                CYC_Active,     globalprefs.ahigp_DisableSurround,
                GA_ID,          ACTID_SURROUND,
              EndObject, FixMinHeight, EndMember,

              StartMember, ar[ACTID_CLIPMV] = CycleObject,
                LAB_Label,      (char *) msgGlobOptMasterVol,
                LAB_Place,      PLACE_LEFT,
                CYC_Labels,     ClipMVLabels,
                CYC_Active,     globalprefs.ahigp_ClipMasterVolume,
                GA_ID,          ACTID_CLIPMV,
              EndObject, FixMinHeight, EndMember,

              StartMember, ar[ACTID_CPULIMIT] = SliderObject,
                LAB_Label,    (char *) msgGlobOptCPULimit,
                SLIDER_Min,   0,
                SLIDER_Max,   100,
                SLIDER_Level, (globalprefs.ahigp_MaxCPU * 100 + 32768) >> 16,
                PGA_NewLook, TRUE,
                GA_ID, ACTID_CPULIMIT,
              EndObject, EndMember,

              EndObject /* vgroup */, EndMember,

              StartMember, VGroupObject, NormalSpacing,

                VarSpace(1),

                StartMember, ar[SHOWID_CPULIMIT] = IndicatorObject,\
                  INDIC_Min,              0,
                  INDIC_Max,              100,
                  INDIC_Level,            (globalprefs.ahigp_MaxCPU * 100 + 32768) / 65536,
                  INDIC_Justification,    IDJ_LEFT,
                  INDIC_FormatString,     "%ld%%",
                EndObject, FixMinWidth, FixMinHeight, EndMember,

              EndObject /* vgroup */, EndMember,
              EndObject /* hgroup */, EndMember,

            EndObject, FixMinWidth, FixMinHeight, EndMember,

            VarSpace(1),

          EndObject /* vgroup */ , FixMinWidth, EndMember,

          VarSpace(1),

        EndObject, /* (EndMember) page */

      EndObject /* page */, EndMember,


/* BUTTONS */
      StartMember, HGroupObject, NormalSpacing, NormalVOffset,

        StartMember, ar[ACTID_SAVE] = ButtonObject,
          ButtonFrame,
          LAB_Label, (char *) msgButtonSave,
          GA_ID,     ACTID_SAVE,
        EndObject, EndMember,

        StartMember, ar[ACTID_USE] = ButtonObject,
          ButtonFrame,
          LAB_Label, (char *) msgButtonUse,
          GA_ID,     ACTID_USE,
        EndObject, EndMember,

        StartMember, ar[ACTID_QUIT] = ButtonObject,
          ButtonFrame,
          LAB_Label, (char *) msgButtonCancel,
          GA_ID,     ACTID_QUIT,
        EndObject, EndMember,
      EndObject, FixMinHeight, EndMember,
    EndObject,
  EndObject;

  if(WO_Window) {
    AddMap( ar[ACTID_TABS], ar[ACTID_PAGE], pagemap );

    DoMethod( ar[ACTID_FREQ],     BASE_ADDHOOK, &GadgetHook );
    DoMethod( ar[ACTID_CHANNELS], BASE_ADDHOOK, &GadgetHook );
    DoMethod( ar[ACTID_OUTVOL],   BASE_ADDHOOK, &GadgetHook );
    DoMethod( ar[ACTID_MONVOL],   BASE_ADDHOOK, &GadgetHook );
    DoMethod( ar[ACTID_GAIN],     BASE_ADDHOOK, &GadgetHook );
    DoMethod( ar[ACTID_INPUT],    BASE_ADDHOOK, &GadgetHook );
    DoMethod( ar[ACTID_OUTPUT],   BASE_ADDHOOK, &GadgetHook );

    AddMap( ar[ACTID_CPULIMIT], ar[SHOWID_CPULIMIT], cpumap);

    window = WindowOpen(WO_Window);
  }

  if(screen) {
    UnlockPubScreen(NULL, screen);
  }

  if(window == NULL) {
    Printf((char *) msgTextNoWindow);
    Printf("\n");
    return FALSE;
  }

  openreq = FileReqObject,
    ASLFR_Window,        window,
    ASLFR_SleepWindow,   TRUE,
    ASLFR_RejectIcons,   TRUE,
    ASLFR_InitialDrawer, "SYS:Prefs/Presets",
  EndObject;

  savereq = FileReqObject,
    ASLFR_Window,        window,
    ASLFR_SleepWindow,   TRUE,
    ASLFR_RejectIcons,   TRUE,
    ASLFR_InitialDrawer, "SYS:Prefs/Presets",
    ASLFR_DoSaveMode,    TRUE,
  EndObject;

  if((openreq == NULL) || (savereq == NULL)) {
    Printf((char *) msgTextNoFileRequester);
    Printf("\n");
    return FALSE;
  }

  // Update the checkmark for "Create Icons?"
  {
    struct Menu     *menu = NULL;
    struct MenuItem *item;

    GetAttr( WINDOW_MenuStrip, WO_Window, (ULONG *) &menu);
    ClearMenuStrip(window);

    item = FindMenuItem(ACTID_ICONS);

    if(item) {
      if(SaveIcons)
        item->Flags |= CHECKED;
      else
        item->Flags &= ~CHECKED;
    }
    ResetMenuStrip(window, menu);
  }

  GUINewUnit();
  return TRUE;
}