예제 #1
0
파일: main.C 프로젝트: xwizard/kde1
// Called by constructor (with config = kapp->getConfig())
// and by session-management (with config = sessionconfig).
// So it has to apply the settings when reading them.
void TEDemo::readProperties(KConfig* config)
{
  config->setGroup("options"); // bad! will no allow us to support multi windows

  // Global options ///////////////////////

  setMenuVisible(config->readBoolEntry("menubar visible",TRUE));
  setFrameVisible(config->readBoolEntry("has frame",TRUE));
  
  scrollbar_menu_activated(QMIN(config->readUnsignedNumEntry("scrollbar",SCRRIGHT),2));

  // not necessary for SM (KTMainWindow does it after), but useful for default settings
  if (menubar->menuBarPos() != KMenuBar::Floating)
  { QString entry = config->readEntry("kmenubar");
    if (!entry.isEmpty() && entry == "floating")
    {
      menubar->setMenuBarPos(KMenuBar::Floating);
      QString geo = config->readEntry("kmenubargeometry");
      if (!geo.isEmpty()) menubar->setGeometry(KWM::setProperties(menubar->winId(), geo));
    }
    else if (!entry.isEmpty() && entry == "top") menubar->setMenuBarPos(KMenuBar::Top);
    else if (!entry.isEmpty() && entry == "bottom") menubar->setMenuBarPos(KMenuBar::Bottom);
  }
  // (geometry stuff removed) done by KTMainWindow for SM, and not needed otherwise

  // Options that should be applied to all sessions /////////////
  // (1) set menu items and TEDemo members
  setBsHack(config->readBoolEntry("BS hack",TRUE));
  setFont(QMIN(config->readUnsignedNumEntry("font",3),7)); // sets n_font and menu item
  setSchema(config->readEntry("schema",""));
  // (2) apply to sessions (currently only the 1st one)
  TESession* s = no2session.find(1);
  if (s) {
    s->setFontNo(n_font);
    s->setSchemaNo(ColorSchema::find(s_schema)->numb);
    if (b_bshack)
      s->getEmulation()->setMode(MODE_BsHack);
    else
      s->getEmulation()->resetMode(MODE_BsHack);      
  } else { fprintf(stderr,"session 1 not found\n"); } // oops

  // Default values for startup, changed by "save options". Not used by SM.
  defaultSize.setWidth ( config->readNumEntry("defaultwidth", 0) );
  defaultSize.setHeight( config->readNumEntry("defaultheight", 0) );
}
예제 #2
0
파일: main.C 프로젝트: xwizard/kde1
void TEDemo::opt_menu_activated(int item)
{
  switch( item )
  {
    case 1: setMenuVisible(!b_menuvis);
            if (!b_menuvis)
            {
              setCaption("Use the right mouse button to bring back the menu");
              QTimer::singleShot(5000,this,SLOT(setHeader()));
            }
            break;
    case 2: setFrameVisible(!b_framevis);
            break;
    case 4: setBsHack(!b_bshack);
            break;
    case 8: saveProperties(kapp->getConfig());
            break;
  }
}
예제 #3
0
파일: application.cpp 프로젝트: wooky/EVA2
	void create()
	{
		//Try to open the character table and populate the arrays
		std::ifstream chrtbl("sma3char.tbl");
		if(chrtbl.fail())
		{
			MessageWindow::critical(Window::none(), "Could not start program because sma3char.tbl is missing.\nEnsure that the file is in the same "
				"directory as the program and try again.");
			exit(1);
		}
		for(int i = 0; i < 256; i++)
			humanToGame[i] = 0;
		
		std::string temp;
		for(int i = 0; i < 256; i++)
		{
			getline(chrtbl, temp);
			gameToHuman[i] = temp[0];
			if(gameToHuman[i] != '#' && gameToHuman[i] != '@')
				humanToGame[static_cast<unsigned int>(gameToHuman[i])] = static_cast<char>(i);
		}
		chrtbl.close();
		
		Replaceables r;
		r.special = "\n";
		r.replacement = std::string("\xFE\x10\x00",3);
		rep.push_back(r);
		
		r.special = ". ";
		r.replacement = 0xF3;
		rep.push_back(r);
		
		//This one is just f'd up
		r.special = "_";
		r.replacement = std::string("\xFE\x20\x00",3);
		rep.push_back(r);
	
		change(false, false);
		setGeometry({128,128,640,480});
		
		//Set some common actions
		onClose = f_sortie.onActivate = [this]() { exit(*this); };
		
		//File menu
		file.setText("File");
		f_oROM.setText("Open ROM...");			f_oROM.onActivate = [this]() { OpenROMFile(*this); };
		f_sROM.setText("Save ROM");				f_sROM.onActivate = [this]() { SaveROMFile(); };
		f_sROMAs.setText("Save ROM As...");
		f_cROM.setText("Close ROM");			f_cROM.onActivate = [this]() { CloseROMFile(*this); };
		f_sortie.setText("Exit");
		file.append(f_oROM, f_sROM, f_sROMAs, sep, f_cROM, f_sortie);
		append(file);
		
		//Game menu
		game.setText("Game");
		g_names.setText("Edit Level Names...");	g_names.onActivate = []() { editlevelnames.show(); };
		//blah blha bkahg fujc
		g_other.setText("Edit Others...");		g_other.onActivate = []() { editother.show(); };
		game.append(g_names, g_other);
		append(game);
		
		//Technical menu
		tech.setText("Technicals");
		t_hex.setText("View Hex Data");			t_hex.onActivate = []() { new ViewHex(); };
		t_chr.setText("View Character Table");	t_chr.onActivate = []() { new ViewCharTable(); };
		tech.append(t_hex, t_chr);
		append(tech);
		
		//Final touches
		toggle(false);
		setMenuVisible();
		setVisible();
	}