コード例 #1
0
ファイル: textstyle.cpp プロジェクト: Archer90/MuseScore
void TextStyleDialog::apply()
      {
      saveStyle(current);                 // update local copy of style list

      int n = cs->style()->textStyles().size();
      for (int i = 0; i < n; ++i) {
            const TextStyle& os = cs->textStyle(i);
            const TextStyle& ns = styles[i];
            if (os != ns) {
                  cs->undo(new ChangeTextStyle(cs, ns));
                  }
            }
      for (int i = n; i < styles.size(); ++i)
            cs->undo(new AddTextStyle(cs, styles[i]));
      cs->end2();
      cs->end();
      }
コード例 #2
0
ファイル: textstyle.cpp プロジェクト: Igevorse/MuseScore
void TextStyleDialog::apply()
      {
      saveStyle(current);                 // update local copy of style list

      int count = textNames->count();
      int numOfStyles = cs->style()->textStyles().size();
      for (int i = 0; i < count; ++i) {
            int listIdx = textNames->item(i)->data(Qt::UserRole).toInt();
            if(listIdx < numOfStyles) {         // style already exists in score text styles
                  const TextStyle& os = cs->textStyle(listIdx);
                  const TextStyle& ns = styles[listIdx];
                  if (os != ns) {
                        cs->undo(new ChangeTextStyle(cs, ns));
                        }
                  }
            else                                // style does not exist in score text styles yet
                  cs->undo(new AddTextStyle(cs, styles[listIdx]));
            }
      cs->update();
      }
コード例 #3
0
ファイル: settings.cpp プロジェクト: nem0/LumixEngine
bool Settings::save()
{
	auto& actions = m_app.getActions();
	FS::OsFile file;
	if (!file.open(SETTINGS_PATH, FS::Mode::CREATE_AND_WRITE)) return false;

	file << "window = { x = " << m_window.x 
		<< ", y = " << m_window.y 
		<< ", w = " << m_window.w
		<< ", h = " << m_window.h << " }\n";

	file << "maximized = " << (m_is_maximized ? "true" : "false") << "\n";

	auto writeBool = [&file](const char* name, bool value) {
		file << name << " = " << (value ? "true\n" : "false\n");
	};

	writeBool("settings_opened", m_is_open);
	writeBool("asset_browser_opened", m_is_asset_browser_open);
	writeBool("entity_list_opened", m_is_entity_list_open);
	writeBool("entity_template_list_opened", m_is_entity_template_list_open);
	writeBool("log_opened", m_is_log_open);
	writeBool("profiler_opened", m_is_profiler_open);
	writeBool("properties_opened", m_is_properties_open);
	writeBool("error_reporting_enabled", m_is_crash_reporting_enabled);
	file << "mouse_sensitivity_x = " << m_mouse_sensitivity.x << "\n";
	file << "mouse_sensitivity_y = " << m_mouse_sensitivity.y << "\n";
	file << "font_size = " << m_font_size << "\n";
	file << "asset_browser_left_column_width = " << m_asset_browser_left_column_width << "\n";
	
	saveStyle(file);

	file << "data_dir = \"";
	const char* c = m_data_dir;
	while (*c)
	{
		if (*c == '\\') file << "\\\\";
		else file << *c;
		++c;
	}
	file << "\"\n";

	file << "custom = {\n";
	lua_getglobal(m_state, "custom");
	lua_pushnil(m_state);
	bool first = true;
	while (lua_next(m_state, -2))
	{
		if (!first) file << ",\n";
		const char* name = lua_tostring(m_state, -2);
		switch (lua_type(m_state, -1))
		{
			case LUA_TBOOLEAN:
				file << name << " = " << (lua_toboolean(m_state, -1) != 0 ? "true" : "false");
				break;
			case LUA_TNUMBER:
				file << name << " = " << (int)lua_tonumber(m_state, -1);
				break;
			default:
				ASSERT(false);
				break;
		}
		lua_pop(m_state, 1);
		first = false;
	}
	lua_pop(m_state, 1);
	file << "}\n";

	file << "actions = {\n";
	for (int i = 0; i < actions.size(); ++i)
	{
		file << "\t" << actions[i]->name << " = {" 
			<< actions[i]->shortcut[0] << ", "
			<< actions[i]->shortcut[1] << ", " 
			<< actions[i]->shortcut[2] << "},\n";
	}
	file << "}\n";

	file << "toolbar = {\n";
	for (auto* action : m_app.getToolbarActions())
	{
		file << "\t\"" << action->name << "\",\n";
	}
	file << "}\n";

	ImGui::SaveDock(file);

	file.close();

	return true;
}
コード例 #4
0
void TextStyleDialog::apply()
      {
      saveStyle(current);     // update local copy of style list
      applyToScore(cs);
      }