Пример #1
0
bool ctApp::UsingTooltips()
{
    return GetSettings().m_useToolTips;
}
Пример #2
0
bool ctApp::OnInit(void)
{

#if wxUSE_LOG
    wxLog::SetTimestamp(NULL);
#endif // wxUSE_LOG

    wxHelpProvider::Set(new wxSimpleHelpProvider);

#if wxUSE_LIBPNG
    wxImage::AddHandler( new wxPNGHandler );
#endif

#if wxUSE_LIBJPEG
    wxImage::AddHandler( new wxJPEGHandler );
#endif

#if wxUSE_GIF
    wxImage::AddHandler( new wxGIFHandler );
#endif

#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
    m_helpController = new wxCHMHelpController;
    m_helpControllerReference = new wxCHMHelpController;
#else
    m_helpController = new wxHtmlHelpController;
    m_helpControllerReference = new wxHtmlHelpController;
#endif

    // Required for HTML help
#if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
    wxFileSystem::AddHandler(new wxZipFSHandler);
#endif

    wxString currentDir = wxGetCwd();

    // Use argv to get current app directory
    wxString argv0(argv[0]);
    wxString appVariableName(wxT("WXCONFIGTOOLDIR"));
    m_appDir = apFindAppPath(argv0, currentDir, appVariableName);

#ifdef __WXMSW__
    // If the development version, go up a directory.
    if ((m_appDir.Right(5).CmpNoCase(_T("DEBUG")) == 0) ||
        (m_appDir.Right(11).CmpNoCase(_T("DEBUGSTABLE")) == 0) ||
        (m_appDir.Right(7).CmpNoCase(_T("RELEASE")) == 0) ||
        (m_appDir.Right(13).CmpNoCase(_T("RELEASESTABLE")) == 0) ||
        (m_appDir.Right(10).CmpNoCase(_T("RELEASEDEV")) == 0) ||
        (m_appDir.Right(8).CmpNoCase(_T("DEBUGDEV")) == 0)
        )
        m_appDir = wxPathOnly(m_appDir);
#endif

    m_docManager = new wxDocManager;
    m_docManager->SetMaxDocsOpen(1);

    //// Create a template relating documents to their views
    (void) new wxDocTemplate(m_docManager, wxGetApp().GetSettings().GetShortAppName(), wxT("*.wxs"), wxT(""), wxT("wxs"), wxT("Doc"), wxT("View"),
        CLASSINFO(ctConfigToolDoc), CLASSINFO(ctConfigToolView));

    m_settings.Init();

    LoadConfig();

    wxString helpFilePathReference(GetFullAppPath(_("wx")));
    m_helpControllerReference->Initialize(helpFilePathReference);

    wxString helpFilePath(GetFullAppPath(_("configtool")));
    m_helpController->Initialize(helpFilePath);

    ctMainFrame* frame = new ctMainFrame(m_docManager, NULL, wxID_ANY, wxGetApp().GetSettings().GetAppName(),
        GetSettings().m_frameSize.GetPosition(), GetSettings().m_frameSize.GetSize(),
        wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
    SetTopWindow(frame);

    switch (wxGetApp().GetSettings().m_frameStatus)
    {
    case ctSHOW_STATUS_MAXIMIZED:
        {
            frame->Maximize(true);
            break;
        }
    case ctSHOW_STATUS_MINIMIZED:
        {
            frame->Iconize(true);
            break;
        }
    default:
    case ctSHOW_STATUS_NORMAL:
        {
            break;
        }
    }

    // Load the file history. This has to be done AFTER the
    // main frame has been created, so that the items
    // will get appended to the file menu.
    {
        wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("Generic Organisation"));
        GetFileHistory().Load(config);
    }

    if (argc > 1)
    {
        // Concatenate strings since it could have spaces (and quotes)
        wxString arg;
        int i;
        for (i = 1; i < argc; i++)
        {
            arg += argv[i];
            if (i < (argc - 1))
                arg += wxString(wxT(" "));
        }
        if (arg[0u] == '"')
            arg = arg.Mid(1);
        if (arg.Last() == '"')
            arg = arg.Mid(0, arg.Len() - 1);

        // Load the file
        wxDocument* doc = m_docManager->CreateDocument(arg, wxDOC_SILENT);
        if (doc)
            doc->SetDocumentSaved(true);
    }
    else
    {
        if (GetSettings().m_loadLastDocument)
        {
            // Load the file that was last loaded
            wxDocument* doc = m_docManager->CreateDocument(GetSettings().m_lastFilename, wxDOC_SILENT);
            if (doc)
                doc->SetDocumentSaved(true);
        }
    }

    GetTopWindow()->Show(true);

    return true;
}
Пример #3
0
void KDesktopConfig::loadSettings()
{
  GetSettings();
}
Пример #4
0
//CT 21Oct1998 - rewritten for using layouts
KDesktopConfig::KDesktopConfig (QWidget * parent, const char *name)
  : KConfigWidget (parent, name)
{

  QBoxLayout *lay = new QVBoxLayout(this, 5);

  ElectricBox = new QButtonGroup(klocale->translate("Active desktop borders"),
				 this);

  QGridLayout *eLay = new QGridLayout(ElectricBox,5,3,10,5);
  eLay->addRowSpacing(0,10);
  eLay->setColStretch(0,0);
  eLay->setColStretch(1,1);

  enable= new
    QCheckBox(klocale->translate("Enable active desktop borders"),
	      ElectricBox);
  enable->adjustSize();
  enable->setMinimumSize(enable->size());
  eLay->addMultiCellWidget(enable,1,1,0,1);

  movepointer = new
    QCheckBox(klocale->translate("Move pointer towards center after switch"),
	      ElectricBox);
  movepointer->adjustSize();
  movepointer->setMinimumSize(movepointer->size());
  eLay->addMultiCellWidget(movepointer,2,2,0,1);

  delaylabel = new QLabel(klocale->translate("Desktop switch delay:"),
			  ElectricBox);
  delaylabel->adjustSize();
  delaylabel->setMinimumSize(delaylabel->size());
  delaylabel->setAlignment(AlignVCenter|AlignLeft);
  eLay->addWidget(delaylabel,3,0);

  delaylcd = new QLCDNumber (2, ElectricBox);
  delaylcd->setFrameStyle( QFrame::NoFrame );
  delaylcd->setFixedHeight(30);
  delaylcd->adjustSize();
  delaylcd->setMinimumSize(delaylcd->size());
  eLay->addWidget(delaylcd,3,1);

  delayslider = new KSlider(0,MAX_EDGE_RES/10,10,0,
			    KSlider::Horizontal, ElectricBox);
  delayslider->setSteps(10,10);
  delayslider->adjustSize();
  delayslider->setMinimumSize(delaylabel->width(), delayslider->height());
  eLay->addMultiCellWidget(delayslider,4,4,1,2);

  connect( delayslider, SIGNAL(valueChanged(int)), delaylcd, SLOT(display(int)) );

  connect( enable, SIGNAL(clicked()), this, SLOT(setEBorders()));

  eLay->activate();

  lay->addWidget(ElectricBox,5);

  //CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config
  MagicBox = new QButtonGroup(klocale->translate("Magic Borders"), this);

  eLay = new QGridLayout(MagicBox,4,3,10,5);
  eLay->addRowSpacing(0,10);
  eLay->addRowSpacing(2,10);
  eLay->setColStretch(0,0);
  eLay->setColStretch(1,0);
  eLay->setColStretch(2,1);

  BrdrSnapLabel = new QLabel(klocale->translate("Border Snap Zone:\n       (pixels)"), MagicBox);
  BrdrSnapLabel->adjustSize();
  BrdrSnapLabel->setMinimumSize(BrdrSnapLabel->size());
  BrdrSnapLabel->setAlignment(AlignTop);
  eLay->addWidget(BrdrSnapLabel,1,0);

  BrdrSnapLCD = new QLCDNumber (2, MagicBox);
  BrdrSnapLCD->setFrameStyle( QFrame::NoFrame );
  BrdrSnapLCD->setFixedHeight(30);
  BrdrSnapLCD->adjustSize();
  BrdrSnapLCD->setMinimumSize(BrdrSnapLCD->size());
  eLay->addWidget(BrdrSnapLCD,1,1);

  BrdrSnapSlider = new KSlider(0,MAX_BRDR_SNAP,1,0,
			       KSlider::Horizontal, MagicBox);
  BrdrSnapSlider->setSteps(1,1);
  BrdrSnapSlider->adjustSize();
  BrdrSnapSlider->setMinimumSize( BrdrSnapLabel->width()+
				  BrdrSnapLCD->width(),
				  BrdrSnapSlider->height());
  eLay->addWidget(BrdrSnapSlider,1,2);
  eLay->addRowSpacing(0,5);

  connect( BrdrSnapSlider, SIGNAL(valueChanged(int)), BrdrSnapLCD, SLOT(display(int)) );

  WndwSnapLabel = new QLabel(klocale->translate("Window Snap Zone:\n       (pixels)"), MagicBox);
  WndwSnapLabel->adjustSize();
  WndwSnapLabel->setMinimumSize(WndwSnapLabel->size());
  WndwSnapLabel->setAlignment(AlignTop);
  eLay->addWidget(WndwSnapLabel,3,0);

  WndwSnapLCD = new QLCDNumber (2, MagicBox);
  WndwSnapLCD->setFrameStyle( QFrame::NoFrame );
  WndwSnapLCD->setFixedHeight(30);
  WndwSnapLCD->adjustSize();
  WndwSnapLCD->setMinimumSize(WndwSnapLCD->size());
  eLay->addWidget(WndwSnapLCD,3,1);

  WndwSnapSlider = new KSlider(0,MAX_WNDW_SNAP,1,0,
			       KSlider::Horizontal, MagicBox);
  WndwSnapSlider->setSteps(1,1);
  WndwSnapSlider->adjustSize();
  WndwSnapSlider->setMinimumSize( WndwSnapLabel->width()+
				  WndwSnapLCD->width(),
				  WndwSnapSlider->height());
  eLay->addWidget(WndwSnapSlider,3,2);

  connect( WndwSnapSlider, SIGNAL(valueChanged(int)), WndwSnapLCD, SLOT(display(int)) );

  eLay->activate();

  lay->addWidget(MagicBox,5);

  lay->activate();

  GetSettings();
}
Пример #5
0
static BOOL CALLBACK NetCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	switch (uMsg) {
	case WM_CLOSE:
		GetSettings(hwndDlg);
		DestroyWindow(hwndDlg);
		netwin = 0;
		FCEUD_NetworkClose();
		break;
	case WM_COMMAND:
		if (HIWORD(wParam) == BN_CLICKED) {
			switch (LOWORD(wParam)) {
			case 250:
				if (FCEUDnetplay) {
					FCEUD_NetworkClose();
					SetDlgItemText(hwndDlg, 250, "Connect");
					FixCDis(hwndDlg, 1);
				} else if (GI) {
					GetSettings(hwndDlg);
					if (FCEUD_NetworkConnect()) {
						SetDlgItemText(hwndDlg, 250, "Disconnect");
						FixCDis(hwndDlg, 0);
					}
				}
				break;
			}
		} else if (HIWORD(wParam) == EN_CHANGE && Socket != INVALID_SOCKET) {
			char buf[1024];
			int t;


			t = GetDlgItemText(hwndDlg, 102, buf, 1024);
			buf[1023] = 0;

			if (strchr(buf, '\r')) {
				char *src, *dest;

				src = dest = buf;

				while (*src) {
					if (*src != '\n' && *src != '\r') {
						*dest = *src;
						dest++;
					}
					src++;
				}
				*dest = 0;
				FCEUI_NetplayText(buf);
				SetDlgItemText(hwndDlg, 102, "");
			}
		}
		break;
	case WM_INITDIALOG:
		if (netplayhost)
			SetDlgItemText(hwndDlg, 200, netplayhost);
		SetDlgItemInt(hwndDlg, 201, remotetport, 0);
		if (netplaynick)
			SetDlgItemText(hwndDlg, 203, netplaynick);
		if (netgamekey)
			SetDlgItemText(hwndDlg, 205, netgamekey);
		if (netpassword)
			SetDlgItemText(hwndDlg, 206, netpassword);

		{
			int x;
			char buf[8];
			for (x = 0; x < 4; x++) {
				sprintf(buf, "%d", x + 1);
				SendDlgItemMessage(hwndDlg, 204, CB_ADDSTRING, 0, (LPARAM)(LPSTR)buf);
			}
			SendDlgItemMessage(hwndDlg, 204, CB_SETCURSEL, netlocalplayers - 1, (LPARAM)(LPSTR)0);
		}


		break;
	}

	return 0;
}
Пример #6
0
bool EDA_APP::OnInit()
{
    wxFileName      filename;
    SCH_EDIT_FRAME* frame = NULL;
    bool fileReady = false;

    InitEDA_Appl( wxT( "Eeschema" ), APP_EESCHEMA_T );

    if( argc > 1 )
        filename = argv[1];

    if( filename.IsOk() )
    {
        if( filename.GetExt() != SchematicFileExtension )
            filename.SetExt( SchematicFileExtension );

        if( !wxGetApp().LockFile( filename.GetFullPath() ) )
        {
            DisplayError( NULL, _( "This file is already open." ) );
            return false;
        }

        fileReady = true;
    }

    if( m_Checker && m_Checker->IsAnotherRunning() )
    {
        if( !IsOK( NULL, _( "Eeschema is already running, Continue?" ) ) )
            return false;
    }

    // Give a default colour for all layers
    // (actual color will be initialized by config)
    for( int ii = 0; ii < NB_SCH_LAYERS; ii++ )
        SetLayerColor( DARKGRAY, ii );

    // read current setup and reopen last directory if no filename to open in
    // command line
    bool reopenLastUsedDirectory = argc == 1;
    GetSettings( reopenLastUsedDirectory );

   /* Must be called before creating the main frame in order to
    * display the real hotkeys in menus or tool tips */
    ReadHotkeyConfig( wxT("SchematicFrame"), s_Eeschema_Hokeys_Descr );

    // Create main frame (schematic frame) :
    frame = new SCH_EDIT_FRAME( NULL, wxT( "Eeschema" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );

    SetTopWindow( frame );
    frame->Show( true );

    CreateServer( frame, KICAD_SCH_PORT_SERVICE_NUMBER );

    frame->Zoom_Automatique( true );

    // Load file specified in the command line:
    if( fileReady )
    {
        if( !filename.GetPath().IsEmpty() )
            // wxSetWorkingDirectory does not like empty paths
            wxSetWorkingDirectory( filename.GetPath() );

        if( frame->LoadOneEEProject( filename.GetFullName(), false ) )
            frame->GetCanvas()->Refresh( true );
    }
    else
    {
        // Read a default config file if no file to load.
        frame->LoadProjectFile( wxEmptyString, true );
        frame->GetCanvas()->Refresh( true );
    }

    return true;
}
Пример #7
0
MouseConfig::MouseConfig (QWidget * parent, const char *name, bool init)
  : KConfigWidget (parent, name)
{
  if (init)
    GUI = FALSE;
  else
    GUI = TRUE;

  if (GUI)
    {
      accel = new KSliderControl(klocale->translate("Acceleration"), 
				 1,20,2,20, "x", 
				 this);
      thresh = new KSliderControl(klocale->translate("Threshold"), 
				  1,20,2,20, klocale->translate("pixels"), 
				  this);
      accel->setLabelSize(0.3);
      thresh->setLabelSize(0.3);
      accel->setLabelAlignment(AlignLeft);
      thresh->setLabelAlignment(AlignLeft);
      accel->setSteps(1,20);
      thresh->setSteps(1,20);

      handedBox = new QButtonGroup(klocale->translate("Button mapping"), 
				   this, "handed");
      rightHanded = new QRadioButton(klocale->translate("Right handed"), 
				     handedBox, "R");
      leftHanded = new QRadioButton(klocale->translate("Left handed"), 
				    handedBox, "L");

      accel->move(SPACE_XO, SPACE_YO);
      accel->resize(accel->minimumSize().width(), 
		    accel->minimumSize().height());
      thresh->move(SPACE_XO, accel->y() + accel->height() + SPACE_YO);
      thresh->resize(thresh->minimumSize().width(), 
		    thresh->minimumSize().height());

      rightHanded->adjustSize();
      leftHanded->adjustSize();

      QFontMetrics fm = handedBox->font();
      int titleH = fm.height();
      int titleW = fm.width(handedBox->title());
      int buttonH = rightHanded->height();
      int buttonW = max( rightHanded->width(), leftHanded->width() );
      int boxH = 2*buttonH + 3*SPACE_YI + titleH;
      int boxW = 0;
      if (boxW < titleW + 4*SPACE_XI)
	boxW =  titleW + 4*SPACE_XI;
      if (boxW < buttonW + 2*SPACE_XI)
	boxW = buttonW + 2*SPACE_XI;
      
      rightHanded->move(SPACE_XI, SPACE_YI + titleH);
      leftHanded->move(SPACE_XI, 2*SPACE_YI + buttonH + titleH);
      handedBox->move(SPACE_XO, thresh->y() + thresh->height() + SPACE_YO);
      handedBox->resize(boxW, boxH);

      // determine minimum size
      int w = max(accel->minimumSize().width(), thresh->minimumSize().width());
      int h = accel->minimumSize().height() + thresh->minimumSize().height() +
	boxH + 4*SPACE_YO;
      setMinimumSize(w,h);
    }

  handedEnabled = TRUE;
  config = kapp->getConfig();

  GetSettings();
}
Пример #8
0
void MouseConfig::loadSettings()
{
  GetSettings();
}
Пример #9
0
void MenuOptions::InitMenu() {
    SetFont(al_load_font("arial.ttf", 30, 0));

    SetMenuHeader("Options");
    SetId(STATES::EDITOROPTIONS);




    MenuItem* itemStore = new MenuItem;
    itemStore->SetMenuItemText("Current Width:");


    //might need to delete this tempval char array? mmm looks to be in stack so should die when method finishs....
    char tempVal[10];
    sprintf_s(tempVal, "%i", GetSettings()->GetScreenWidth());


    itemStore->InitMenuItemProperty(al_ustr_new(tempVal));
    itemStore->SetMenuItemTargetable(false);
    AddMenuItem(itemStore);





    itemStore = new MenuItem;
    itemStore->InitMenuItemProperty(al_ustr_new(""));
    itemStore->SetOptionId(OPTIONTYPES::WIDTHOPTION);
    itemStore->SetMenuItemText("New Width:");
    AddMenuItem(itemStore);




    itemStore = new MenuItem;
    itemStore->SetMenuItemText("Current Height:");

    sprintf_s(tempVal, "%i", GetSettings()->GetScreenHeight());

    itemStore->InitMenuItemProperty(al_ustr_new(tempVal));
    itemStore->SetMenuItemTargetable(false);
    AddMenuItem(itemStore);






    itemStore = new MenuItem;
    itemStore->InitMenuItemProperty(al_ustr_new(""));
    itemStore->SetOptionId(OPTIONTYPES::HEIGHTOPTION);
    itemStore->SetMenuItemText("New Height:");
    AddMenuItem(itemStore);




    itemStore = new MenuItem;
    itemStore->SetId(STATES::SAVE);
    itemStore->SetMenuItemText("Save");
    AddMenuItem(itemStore);

    itemStore = new MenuItem;
    itemStore->SetId(STATES::RETURN);
    itemStore->SetMenuItemText("Return");
    AddMenuItem(itemStore);



    SetMenuX(200);
    SetMenuY(100);
    SetMenuWidth(400);
    SetMenuHeight(400);

    SetMenuHeaderX(200);
    SetMenuHeaderY(50);
    SetMenuHeaderWidth(400);
    SetMenuHeaderHeight(50);

    int i = 0;
    int xloc = 355;
    int yloc = 110;
    int yspacing = 50;
    for(i = 0; i < GetMenuItems().size(); i++)
    {
        GetMenuItems()[i]->SetMenuItemX(xloc);
        GetMenuItems()[i]->SetMenuItemPropertyX(400+100);
        GetMenuItems()[i]->SetMenuItemY(yloc);
        yloc = yloc + yspacing;
    }
    SetMenuHeight(yloc-GetMenuY());

    SetCurrentSelection();
}