Example #1
0
PrintDocumentResult::PrintingResultEnum PrintDocumentResult::getResult(bool& wasOk, Glib::ustring& printStatus )
{
	wasOk= this->wasSuccess;
	printStatus.assign ("-");
	printStatus = this->printerStatusDetail;
	return this->printingResult;
}
Example #2
0
 /**
  * Get active string selected by user.
  *
  * @return Glib::ustring selected by user it ComboBox.
  */
 Glib::ustring get_active_string() const {
     Glib::ustring result;
     Gtk::TreeModel::iterator it = get_active();
     if (it and *it) {
         result.assign((*it)[mColumn.mString]);
     }
     return result;
 }
/* Method save_xml */
void ClusterSettings::save_xml (const Glib::ustring& filename)
{
  /* Create xml document */
  TiXmlDocument doc;

  /* XML Declaration */
  TiXmlDeclaration *decl = new TiXmlDeclaration ("0.0", "", "");
  doc.LinkEndChild (decl);

  /* Root element */
  TiXmlElement *root = new TiXmlElement ("SensorsClusterSettings");
  doc.LinkEndChild (root);

  /* Comment */
  Glib::ustring message;
  message.assign (" File created by ComLibSim at [");
  message.append (filename);
  message.append ("] ");
  TiXmlComment *comment = new TiXmlComment ();
  comment->SetValue (message.c_str ());
  root->LinkEndChild (comment);

  /* Cluster element */
  TiXmlElement *cluster = new TiXmlElement ("Cluster");
  root->LinkEndChild (cluster);

  /* Set cluster attribute */
  cluster->SetAttribute ("name", m_Name.c_str ());

  /* Sensors element */
  TiXmlElement *sensorsNode = new TiXmlElement ("Sensors");
  root->LinkEndChild (sensorsNode);

  /* Set sensor element and attributes */
  std::list<SensorSettings>::iterator iter;
  for (iter=m_Sensors.begin (); iter != m_Sensors.end (); iter++)
  {
    const SensorSettings& sensor_iter = *iter;

    /* Sensor element */
    TiXmlElement *sensor = new TiXmlElement ("Sensor");
    sensorsNode->LinkEndChild (sensor);

    /* Set sensor attributes */
    sensor->SetAttribute ("tag", iter->get_tag ().c_str ());
    sensor->SetAttribute ("online", iter->get_online ());
    sensor->SetDoubleAttribute ("x", iter->get_x_coord ());
    sensor->SetDoubleAttribute ("y", iter->get_y_coord ());
    sensor->SetAttribute ("adata", iter->get_amount_data ());
    sensor->SetAttribute ("type", iter->get_type ().c_str ());
  }

  /* Save xml to file */
  doc.SaveFile (filename.c_str ());
}
Example #4
0
/* Method TreeModel_to_XML */
void ClusterSettings::TreeModel_to_XML (const Glib::ustring& filename,
                                Glib::RefPtr<Gtk::ListStore> sensors_list)
{
  /* Get ListStore contents */
  sensors_list->foreach_iter (sigc::mem_fun (*this,
                             &ClusterSettings::on_foreach_iter));

  /* Create xml document */
  xmlpp::Document doc;

  /* Create root node */
  xmlpp::Element *root_node = doc.create_root_node ("SensorsClusterSettings");

  /* Add root comment */
  Glib::ustring message;
  message.assign ("File created by ComLibSim at [");
  message.append (filename);
  message.append ("]");
  root_node->add_child_comment (message);

  /* Create and set cluster node */
  xmlpp::Element *cluster_node = root_node->add_child ("Cluster");
  cluster_node->set_attribute ("name", m_Name);

  /* Create and set sensor elements */
  std::list<SensorSettings>::iterator iter;
  for (iter=m_Sensors.begin (); iter != m_Sensors.end (); iter++)
  {
    const SensorSettings& sensor_iter = *iter;

    /* Sensor element */
    xmlpp::Element *sensor_element = cluster_node->add_child ("Sensor");

    /* Set sensor attributes */
    sensor_element->set_attribute ("tag", iter->get_tag ());
    sensor_element->set_attribute ("online", iter->get_online_as_string ());
    Glib::ustring tmp;
    tmp = Glib::ustring::format (std::fixed, std::setprecision (6),
                                 iter->get_x ());
    sensor_element->set_attribute ("x", tmp);
    tmp = Glib::ustring::format (std::fixed, std::setprecision (6),
                                 iter->get_y ());
    sensor_element->set_attribute ("y", tmp);
    tmp = Glib::ustring::format (std::fixed, std::setprecision (0),
                                 iter->get_adata ());
    sensor_element->set_attribute ("adata", tmp);
    sensor_element->set_attribute ("type", iter->get_type ());
  }

  /* Save to xml file */
  doc.write_to_file (filename);
}
Example #5
0
bool
optionsfile::parse( perform *a_perf )
{

    /* file size */
    int file_size = 0;

    /* open binary file */
    ifstream file ( m_name.c_str(), ios::in | ios::ate );

    if( ! file.is_open() )
        return false;
    
    file_size = file.tellg();

    /* run to start */
    file.seekg( 0, ios::beg );

    line_after( &file, "[midi-clock]" );
    long buses = 0;
    sscanf( m_line, "%ld", &buses );
    next_data_line( &file );

    for ( int i=0; i<buses; ++i ){

        long bus_on, bus;
        sscanf( m_line, "%ld %ld", &bus, &bus_on );
        a_perf->get_master_midi_bus( )->set_clock( bus, (clock_e) bus_on );
        next_data_line( &file );
    }


    line_after( &file, "[keyboard-control]" );

    sscanf( m_line, "%u", &a_perf->m_key_start );
    next_data_line( &file );

    sscanf( m_line, "%u", &a_perf->m_key_stop );
    next_data_line( &file );

    sscanf( m_line, "%u", &a_perf->m_key_loop );
    next_data_line( &file );

    sscanf( m_line, "%u", &a_perf->m_key_bpm_dn );
    next_data_line( &file );

    sscanf( m_line, "%u", &a_perf->m_key_bpm_up );

    line_after( &file, "[jack-transport]" );
    long flag = 0;
    
    sscanf( m_line, "%ld", &flag );
    global_with_jack_transport = (bool) flag;
    
    next_data_line( &file );
    sscanf( m_line, "%ld", &flag );
    global_with_jack_master = (bool) flag;
    
    next_data_line( &file );
    sscanf( m_line, "%ld", &flag );
    global_with_jack_master_cond = (bool) flag;
    

    line_after( &file, "[midi-input]" );
    buses = 0;
    sscanf( m_line, "%ld", &buses );
    next_data_line( &file );

    for ( int i=0; i<buses; ++i ){

        long bus_on, bus;
        sscanf( m_line, "%ld %ld", &bus, &bus_on );
        a_perf->get_master_midi_bus( )->set_input( bus, (bool) bus_on );
        next_data_line( &file );
    }
    
    /* midi clock mod */
    long ticks = 64;
    line_after( &file, "[midi-clock-mod-ticks]" );
    sscanf( m_line, "%ld", &ticks );
    midibus::set_clock_mod(ticks);


    /* manual alsa ports */
    line_after( &file, "[manual-alsa-ports]" );
    sscanf( m_line, "%ld", &flag );
    global_manual_alsa_ports = (bool) flag;

    /* last used dir */
    line_after( &file, "[last-used-dir]" );
    //FIXME: check for a valid path is missing
    if (m_line[0] == '/')
        last_used_dir.assign(m_line);

    /* interaction method  */
    long method = 0;
    line_after( &file, "[interaction-method]" );
    sscanf( m_line, "%ld", &method );
    global_interactionmethod = (interaction_method_e)method;
    
    file.close();

    return true;
}