本文整理汇总了C++中ProjectConfiguration::language_get方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectConfiguration::language_get方法的具体用法?C++ ProjectConfiguration::language_get怎么用?C++ ProjectConfiguration::language_get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectConfiguration
的用法示例。
在下文中一共展示了ProjectConfiguration::language_get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProgressWindow
CheckValidateReferences::CheckValidateReferences(const ustring & project, const vector < unsigned int >&books, bool gui)
/*
It checks on the correctness and existence of the references found in the
text and in the notes.
project: project to check.
books: books to check; if empty it checks them all.
gui: whether to show graphical progressbar.
*/
{
// The variables and settings.
cancelled = false;
myproject = project;
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(project);
versification = projectconfig->versification_get();
language = projectconfig->language_get();
// Get a list of the books to check. If no books were given, take them all.
vector < unsigned int >mybooks(books.begin(), books.end());
if (mybooks.empty())
mybooks = project_get_books(project);
// GUI.
progresswindow = NULL;
if (gui) {
progresswindow = new ProgressWindow(_("Validating references"), true);
progresswindow->set_iterate(0, 1, mybooks.size());
}
// Go through each book.
for (unsigned int bk = 0; bk < mybooks.size(); bk++) {
if (gui) {
progresswindow->iterate();
if (progresswindow->cancel) {
cancelled = true;
return;
}
}
book = mybooks[bk];
// Go through each chapter.
vector < unsigned int >chapters = project_get_chapters(project, book);
for (unsigned int ch = 0; ch < chapters.size(); ch++) {
chapter = chapters[ch];
// Go through each verse.
vector < ustring > verses = project_get_verses(project, book, chapter);
for (unsigned int vs = 0; vs < verses.size(); vs++) {
verse = verses[vs];
// Check the text.
ustring line = project_retrieve_verse(project, book, chapter, verse);
check(line);
}
}
}
}
示例2: notes_display
void notes_display(ustring& note_buffer, vector <unsigned int> ids, unsigned int cursor_id, unsigned int &cursor_offset, bool & stop, unsigned int edited_note_id)
/*
This collect html data for displaying the notes.
It collects data for all the notes that have an id given in ids.
It inserts a html anchor at the start of the note whose id is "cursor_id".
If an "edited_note_id" is given that is not in the list of "ids", then it will display that one too, together with a message.
*/
{
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(settings->genconfig.project_get());
ustring language = projectconfig->language_get();
// Whether to show the text of the reference(s).
bool show_reference_text = settings->genconfig.notes_display_reference_text_get();
// Whether to show the summary only.
bool show_summary = settings->genconfig.notes_display_summary_get();
// See whether to display an extra note, one just edited.
if (edited_note_id) {
set <unsigned int> id_set (ids.begin(), ids.end());
if (id_set.find (edited_note_id) == id_set.end()) {
notes_display_internal(language, show_reference_text, show_summary, note_buffer, edited_note_id,
_("The following note is displayed because it was created or edited. Normally it would not have been displayed."),
cursor_id, cursor_offset);
}
}
// Go through all the notes.
for (unsigned int c = 0; c < ids.size(); c++) {
// Handle possible stop command.
if (stop)
continue;
// Display this note.
notes_display_internal(language, show_reference_text, show_summary, note_buffer, ids[c], NULL, cursor_id, cursor_offset);
}
}
示例3: shortcuts
RevertDialog::RevertDialog(Reference * reference)
{
// Save variables.
extern Settings *settings;
project = settings->genconfig.project_get();
ProjectConfiguration *projectconfig = settings->projectconfig(project);
language = projectconfig->language_get();
reference_chapter = reference->chapter_get();
revisionloaded = false;
branch = 0;
// Build dialog.
Shortcuts shortcuts(0);
revertdialog = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(revertdialog), _("Revert"));
gtk_window_set_position(GTK_WINDOW(revertdialog), GTK_WIN_POS_CENTER_ON_PARENT);
gtk_window_set_type_hint(GTK_WINDOW(revertdialog), GDK_WINDOW_TYPE_HINT_DIALOG);
dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (revertdialog));
gtk_widget_show(dialog_vbox1);
hbox1 = gtk_hbox_new(FALSE, 0);
gtk_widget_show(hbox1);
gtk_box_pack_start(GTK_BOX(dialog_vbox1), hbox1, TRUE, TRUE, 0);
vbox1 = gtk_vbox_new(FALSE, 0);
gtk_widget_show(vbox1);
gtk_box_pack_start(GTK_BOX(hbox1), vbox1, TRUE, TRUE, 0);
table1 = gtk_table_new(2, 2, FALSE);
gtk_widget_show(table1);
gtk_box_pack_start(GTK_BOX(vbox1), table1, FALSE, TRUE, 0);
comboboxbook = gtk_combo_box_new_text();
gtk_widget_show(comboboxbook);
gtk_table_attach(GTK_TABLE(table1), comboboxbook, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
comboboxchapter = gtk_combo_box_new_text();
gtk_widget_show(comboboxchapter);
gtk_table_attach(GTK_TABLE(table1), comboboxchapter, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0);
labelbook = gtk_label_new(_("Book"));
gtk_widget_show(labelbook);
gtk_table_attach(GTK_TABLE(table1), labelbook, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment(GTK_MISC(labelbook), 0, 0.5);
shortcuts.label(labelbook);
gtk_label_set_mnemonic_widget(GTK_LABEL(labelbook), comboboxbook);
labelchapter = gtk_label_new(_("Chapter"));
gtk_widget_show(labelchapter);
gtk_table_attach(GTK_TABLE(table1), labelchapter, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment(GTK_MISC(labelchapter), 0, 0.5);
shortcuts.label(labelchapter);
gtk_label_set_mnemonic_widget(GTK_LABEL(labelchapter), comboboxchapter);
hseparator1 = gtk_hseparator_new();
gtk_widget_show(hseparator1);
gtk_box_pack_start(GTK_BOX(vbox1), hseparator1, FALSE, TRUE, 0);
labelrevisions = gtk_label_new(_("Revisions"));
gtk_widget_show(labelrevisions);
gtk_box_pack_start(GTK_BOX(vbox1), labelrevisions, FALSE, FALSE, 0);
gtk_misc_set_alignment(GTK_MISC(labelrevisions), 0, 0.5);
shortcuts.label(labelrevisions);
scrolledwindowrevisions = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(scrolledwindowrevisions);
gtk_box_pack_start(GTK_BOX(vbox1), scrolledwindowrevisions, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindowrevisions), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindowrevisions), GTK_SHADOW_IN);
treeviewrevisions = gtk_tree_view_new();
gtk_widget_show(treeviewrevisions);
gtk_container_add(GTK_CONTAINER(scrolledwindowrevisions), treeviewrevisions);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeviewrevisions), FALSE);
gtk_label_set_mnemonic_widget(GTK_LABEL(labelrevisions), treeviewrevisions);
// Create treeview related stuff.
store = gtk_list_store_new(1, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(treeviewrevisions), GTK_TREE_MODEL(store));
g_object_unref(store);
GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(treeviewrevisions), column);
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeviewrevisions));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
vseparator1 = gtk_vseparator_new();
gtk_widget_show(vseparator1);
gtk_box_pack_start(GTK_BOX(hbox1), vseparator1, FALSE, TRUE, 0);
vbox2 = gtk_vbox_new(FALSE, 0);
gtk_widget_show(vbox2);
//.........这里部分代码省略.........
示例4: shortcuts
GotoReferenceDialog::GotoReferenceDialog(unsigned int currentbook, unsigned int currentchapter, const ustring & currentverse)
{
// Init variables
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(settings->genconfig.project_get());
language = projectconfig->language_get();
newreference = false;
oldbook = currentbook;
oldchapter = currentchapter;
oldverse = currentverse;
go_back = false;
go_forward = false;
Shortcuts shortcuts(0);
gtkbuilder = gtk_builder_new ();
gtk_builder_add_from_file (gtkbuilder, gw_build_filename (Directories->get_package_data(), "gtkbuilder.gotoreferencedialog.xml").c_str(), NULL);
dialog = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "dialog"));
g_signal_connect((gpointer) dialog, "key_press_event", G_CALLBACK(on_key_press_event), gpointer(this));
notebook = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "notebook"));
// Enter current reference into the free entry, and select it, so user can use that.
entry_free = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "entry_free"));
gtk_widget_grab_focus(entry_free);
ustring ref = books_id_to_name(language, currentbook) + " " + convert_to_string(currentchapter) + ":" + currentverse;
gtk_entry_set_text(GTK_ENTRY(entry_free), ref.c_str());
gtk_editable_select_region(GTK_EDITABLE(entry_free), 0, -1);
// Completion for the reference entry.
completion_setup(entry_free, cpGoto);
// Signals entry.
g_signal_connect((gpointer) entry_free, "activate", G_CALLBACK(on_entry_free_activate), gpointer(this));
// Aided entry widgets.
treeview_book = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "treeview_book"));
treeview_chapter = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "treeview_chapter"));
treeview_verse = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "treeview_verse"));
// Connect to the signals of the treeviews.
g_signal_connect_after((gpointer) treeview_book, "move_cursor", G_CALLBACK(on_treeview_book_move_cursor), gpointer(this));
g_signal_connect_after((gpointer) treeview_book, "row_activated", G_CALLBACK(on_treeview_book_row_activated), gpointer(this));
g_signal_connect_after((gpointer) treeview_chapter, "move_cursor", G_CALLBACK(on_treeview_chapter_move_cursor), gpointer(this));
g_signal_connect_after((gpointer) treeview_chapter, "row_activated", G_CALLBACK(on_treeview_chapter_row_activated), gpointer(this));
g_signal_connect_after((gpointer) treeview_verse, "move_cursor", G_CALLBACK(on_treeview_verse_move_cursor), gpointer(this));
g_signal_connect_after((gpointer) treeview_verse, "row_activated", G_CALLBACK(on_treeview_verse_row_activated), gpointer(this));
// Create stores and fill the book store.
store_book = gtk_list_store_new(1, G_TYPE_STRING);
store_chapter = gtk_list_store_new(1, G_TYPE_STRING);
store_verse = gtk_list_store_new(1, G_TYPE_STRING);
vector < unsigned int >ibooks = project_get_books(settings->genconfig.project_get());
vector < ustring > ubooks;
for (unsigned int i = 0; i < ibooks.size(); i++)
ubooks.push_back(books_id_to_name(language, ibooks[i]));
listview_set_strings(treeview_book, store_book, ubooks);
// Set the stores as models for the treeviews.
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview_book), GTK_TREE_MODEL(store_book));
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview_chapter), GTK_TREE_MODEL(store_chapter));
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview_verse), GTK_TREE_MODEL(store_verse));
// Unreference the stores once, so they get destroyed with the treeview.
g_object_unref(store_book);
g_object_unref(store_chapter);
g_object_unref(store_verse);
// Text cell renderer.
GtkCellRenderer *renderer;
renderer = gtk_cell_renderer_text_new();
// Columns.
GtkTreeViewColumn *column_book;
column_book = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview_book), column_book);
GtkTreeViewColumn *column_chapter;
column_chapter = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview_chapter), column_chapter);
GtkTreeViewColumn *column_verse;
column_verse = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview_verse), column_verse);
// Set up the selection for each of the tree views.
GtkTreeSelection *select_book;
select_book = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview_book));
gtk_tree_selection_set_mode(select_book, GTK_SELECTION_SINGLE);
GtkTreeSelection *select_chapter;
select_chapter = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview_chapter));
gtk_tree_selection_set_mode(select_chapter, GTK_SELECTION_SINGLE);
GtkTreeSelection *select_verse;
select_verse = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview_verse));
gtk_tree_selection_set_mode(select_verse, GTK_SELECTION_SINGLE);
// History back.
radiobutton_back = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_back"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_back), true);
// History forward.
//.........这里部分代码省略.........
示例5: load_webview
//.........这里部分代码省略.........
// Display the keyterms in the verse, and their renderings.
htmlwriter.heading_open (3);
htmlwriter.text_add (_("Keyterms in verse ") + myreference.verse);
htmlwriter.heading_close ();
vector <int> keyterms = keyterms_get_terms_in_verse(myreference);
for (unsigned int i = 0; i < keyterms.size(); i++) {
htmlwriter.paragraph_open();
// Display the keyterm.
ustring term;
keyterms_get_term(keyterms[i], term);
htmlwriter.text_add ("* ");
ustring url = "keyterm " + convert_to_string (keyterms[i]);
htmlwriter.hyperlink_add (url, term);
htmlwriter.text_add (": ");
// Display the renderings.
vector <ustring> renderings;
vector <bool> wholewords;
vector <bool> casesensitives;
ustring category;
{
ustring dummy1;
vector < Reference > dummy2;
keyterms_get_data(keyterms[i], category, dummy1, dummy2);
}
keyterms_retrieve_renderings(myproject, term, category, renderings, wholewords, casesensitives);
for (unsigned int i2 = 0; i2 < renderings.size(); i2++) {
if (i2)
htmlwriter.text_add (", ");
htmlwriter.text_add (renderings[i2]);
}
htmlwriter.paragraph_close();
}
// If there are no keyterms, mention this.
if (keyterms.empty()) {
htmlwriter.paragraph_open ();
htmlwriter.text_add ("none");
htmlwriter.paragraph_close ();
}
// Terms derived from the Strong's numbers in this verse.
htmlwriter.heading_open (3);
htmlwriter.text_add (_("Similar words in other verses"));
htmlwriter.heading_close ();
// Get the data.
vector <ustring> strongs;
vector <ustring> words;
kjv_get_strongs_data (myreference, strongs, words);
// Display the data.
for (unsigned int i = 0; i < strongs.size(); i++) {
htmlwriter.paragraph_open ();
Parse parse (strongs[i]);
for (unsigned int i2 = 0; i2 < parse.words.size (); i2++) {
htmlwriter.text_add (words[i]);
htmlwriter.text_add (" ");
ustring url = "strong " + parse.words[i2];
htmlwriter.hyperlink_add (url, parse.words[i2]);
}
htmlwriter.paragraph_close ();
}
// Parallel passages.
vector <Reference> parallel_references;
vector <ustring> parallel_comments;
parallel_passages_retrieve (myreference, parallel_references, parallel_comments);
if (!parallel_references.empty()) {
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(myproject);
ustring language = projectconfig->language_get();
htmlwriter.heading_open (3);
htmlwriter.text_add (_("Parallel passages"));
htmlwriter.heading_close ();
for (unsigned int i = 0; i < parallel_references.size(); i++) {
htmlwriter.paragraph_open ();
htmlwriter.text_add (parallel_references[i].human_readable (language) + " " + parallel_comments[i]);
htmlwriter.paragraph_close ();
}
htmlwriter.paragraph_open ();
htmlwriter.hyperlink_add ("parallels", _("Send to references window"));
htmlwriter.paragraph_close ();
}
}
htmlwriter.finish();
if (display_another_page) {
// Load the page.
webkit_web_view_load_string (WEBKIT_WEB_VIEW (webview), htmlwriter.html.c_str(), NULL, NULL, NULL);
// Scroll to the position that possibly was stored while this url was last active.
GtkAdjustment * adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolledwindow));
gtk_adjustment_set_value (adjustment, scrolling_position[active_url]);
}
}
示例6: shortcuts
SelectBooksDialog::SelectBooksDialog(bool showportions, GtkWindow *parent)
/*
This dialog selects books.
This function takes the book from the project that is now open, and
the language of that project.
It then loads the books.
bookset: Indicator for the caller's relevant books.
*/
{
// Initialize variables.
extern Settings *settings;
myproject = settings->genconfig.project_get();
ProjectConfiguration *projectconfig = settings->projectconfig(myproject);
mylanguage = projectconfig->language_get();
myselectables = project_get_books(myproject);
myshowportions = showportions;
// Build dialog.
Shortcuts shortcuts(0);
selectbooksdialog = gtk_dialog_new();
ustring title(_("Select books"));
if (showportions) {
title.append(_(" and portions"));
}
gtk_window_set_title(GTK_WINDOW(selectbooksdialog), title.c_str());
gtk_window_set_transient_for(GTK_WINDOW(selectbooksdialog), parent);
gtk_window_set_position(GTK_WINDOW(selectbooksdialog), GTK_WIN_POS_CENTER_ALWAYS); // was GTK_WIN_POS_CENTER_ON_PARENT
gtk_window_set_modal(GTK_WINDOW(selectbooksdialog), TRUE);
dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG(selectbooksdialog));
gtk_widget_show(dialog_vbox1);
vbox1 = gtk_vbox_new(FALSE, 0);
gtk_widget_show(vbox1);
gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox1, TRUE, TRUE, 0);
hbox11 = gtk_hbox_new(FALSE, 0);
gtk_widget_show(hbox11);
gtk_box_pack_start(GTK_BOX(vbox1), hbox11, TRUE, TRUE, 0);
vbox2 = gtk_vbox_new(FALSE, 0);
gtk_widget_show(vbox2);
gtk_box_pack_start(GTK_BOX(hbox11), vbox2, TRUE, TRUE, 0);
labelbooks = gtk_label_new(_("Books"));
gtk_widget_show(labelbooks);
gtk_box_pack_start(GTK_BOX(vbox2), labelbooks, FALSE, FALSE, 0);
shortcuts.label(labelbooks);
scrolledwindowbooks = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(scrolledwindowbooks);
gtk_box_pack_start(GTK_BOX(vbox2), scrolledwindowbooks, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindowbooks), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindowbooks), GTK_SHADOW_IN);
treeviewbooks = gtk_tree_view_new();
gtk_widget_show(treeviewbooks);
gtk_container_add(GTK_CONTAINER(scrolledwindowbooks), treeviewbooks);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeviewbooks), FALSE);
vbox3 = gtk_vbox_new(FALSE, 0);
gtk_widget_show(vbox3);
gtk_box_pack_start(GTK_BOX(hbox11), vbox3, TRUE, TRUE, 0);
if (myshowportions) {
labelportions = gtk_label_new(_("Portions"));
gtk_widget_show(labelportions);
gtk_box_pack_start(GTK_BOX(vbox3), labelportions, FALSE, FALSE, 0);
shortcuts.label(labelportions);
scrolledwindowportions = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(scrolledwindowportions);
gtk_box_pack_start(GTK_BOX(vbox3), scrolledwindowportions, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindowportions), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindowportions), GTK_SHADOW_IN);
treeviewportions = gtk_tree_view_new();
gtk_widget_show(treeviewportions);
gtk_container_add(GTK_CONTAINER(scrolledwindowportions), treeviewportions);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeviewportions), FALSE);
}
table1 = gtk_table_new(2, 3, FALSE);
gtk_widget_show(table1);
gtk_box_pack_start(GTK_BOX(vbox1), table1, FALSE, FALSE, 0);
nobutton = gtk_button_new();
gtk_widget_show(nobutton);
gtk_table_attach(GTK_TABLE(table1), nobutton, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
alignment1 = gtk_alignment_new(0.5, 0.5, 0, 0);
gtk_widget_show(alignment1);
gtk_container_add(GTK_CONTAINER(nobutton), alignment1);
hbox4 = gtk_hbox_new(FALSE, 2);
//.........这里部分代码省略.........