Exemplo n.º 1
0
static void
showed_message_cb (GtrTab *tab, GtrMsg *msg, GtrContextPanel *panel)
{
  GtkTextBuffer *buffer;
  GtkTextIter iter;
  GtkTextTag *bold;

  /* Update current msg */
  panel->priv->current_msg = msg;

  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (panel->priv->context));
  gtk_text_buffer_set_text (buffer, "", 0);
  gtk_text_buffer_get_start_iter (buffer, &iter);

  /* Create the bold tag for headers */
  bold = gtk_text_buffer_create_tag (buffer, NULL, "weight", PANGO_WEIGHT_BOLD,
                                     "weight-set", TRUE, NULL);

  /* Add custom comments */
  add_notes (buffer, &iter, bold, msg);

  /* Extracted comments */
  add_text (buffer, bold, &iter, _("Extracted comments:"),
            gtr_msg_get_extracted_comments (msg));

  /* Context */
  add_text (buffer, bold, &iter, _("Context:"),
            gtr_msg_get_msgctxt (msg));

  /* Format */
  add_text (buffer, bold, &iter, _("Format:"),
            gtr_msg_get_format (msg));
}
static gchar*
make_complex_trans_line (Account *acc, Transaction *trans, Split *split, CsvExportInfo *info)
{
    gboolean t_void = xaccTransGetVoidStatus (trans);

    gchar *result = begin_trans_string (trans, info);
    result = add_type (result, trans, info);
    result = add_second_date (result, trans, info);
    result = add_account_name (result, acc, NULL, FALSE, info);
    result = add_number (result, trans, info);
    result = add_description (result, trans, info);
    result = add_notes (result, trans, info);
    result = add_memo (result, split, info);
    result = add_category (result, split, TRUE, info);
    result = add_category (result, split, FALSE, info);
    result = add_line_type (result, TRANS_COMPLEX, info);
    result = add_action (result,split, TRANS_COMPLEX, info);
    result = add_reconcile (result, split, info);
    result = add_amount (result, split, t_void, TRUE, TRANS_COMPLEX, info);
    result = add_comm_mnemonic (result, trans, NULL, info);
    result = add_comm_namespace (result, trans, NULL, info);
    result = add_trans_eol (result, info);
    return result;
}
Exemplo n.º 3
0
void CwVoice::add_notes(std::ifstream *ifile, CwLabelList *label_list, std::string voice_name)
{
	char line[256];
	std::string str_line;

	const std::string based_on = "BasedOn=";
	const int len_based_on = based_on.length();

	long pos = (label_list->label_pos)(voice_name);
	if (pos == -1)
	{
		MIDIFile::message("No voice-note_label %s",voice_name.c_str());
		return; // no notes
	}

//	MIDIFile::message("CwVoice::add_notes from %s",voice_name.c_str());
	long initial_pos = ifile->tellg();

	ifile->clear();
	ifile->seekg(pos); // start at the label

	bool is_error;
	while (true)
	{
		ifile->getline(line,256);

		is_error = false;
		if (ifile->eof())
		{
			ifile->clear();
			break;
		}

		if (line[0] == '[')
		{
			break;
		}

		str_line = line;
		if (str_line.substr(0,len_based_on)==based_on)
		{
			std::string based_on_voice = str_line.substr(len_based_on);
			add_notes(ifile,label_list,based_on_voice);
			continue;
		}

		char ch = line[0];
		if ((ch<'0')||(ch>'9'))
		{
			continue;
		}

		int last = str_line.find("=");

		if (last < 0)
		{
			continue;
		}

		int no = 0;
		int i;
		
		for (i=0; i<last; i++)
		{
			ch = line[i];
			if ((ch<'0')||(ch>'9'))
			{
				MIDIFile::message("error note number, line %s",line);
				is_error = true;
				break;
			}
			no = 10*no+(ch-'0');
		}

		if (is_error) 
		{
			break;
		}

		if (no>128)
		{
			MIDIFile::message("error note number");
			break;
		}

		std::string text = str_line.substr(last+1);
		notes[no].note_name = text;
	}

	ifile->seekg(initial_pos);
}