-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelperPanel.cc
66 lines (54 loc) · 2.18 KB
/
HelperPanel.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "HelperPanel.h"
#include <sstream>
#include "config.h"
#define SPACING 6
using namespace Glib;
using namespace std;
HelperPanel::HelperPanel() {
this->pack_start(m_vsep, false, false);
this->pack_start(m_main_box, true, true, SPACING);
this->show_all();
m_main_box.pack_start(m_usage_lines, false, false, SPACING);
m_usage_lines.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
m_usage_lines.set_markup(_("<b>Used in</b>:"));
m_usage_scr.add(m_usage_lines_content);
m_usage_scr.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
m_usage_lines_content.set_sensitive(false);
m_main_box.pack_start(m_usage_scr, false, false);
m_main_box.pack_start(m_context, false, false, SPACING);
m_context.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
this->setContext("");
m_main_box.pack_start(m_extracted_comments, false, false, SPACING);
m_extracted_comments.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
m_extracted_comments.set_line_wrap(true);
this->setExtractedComments("");
m_main_box.pack_start(m_comment_lb, false, false);
m_main_box.pack_start(m_scr);
m_scr.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
m_scr.add(m_comment_entry);
m_comment_lb.set_markup(_("<b>Comment: </b>"));
m_comment_lb.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
this->show_all();
}
void HelperPanel::setUsageLines(std::vector<Glib::ustring> usage_lines) {
ostringstream ostr;
for (vector<ustring>::iterator it = usage_lines.begin(); it < usage_lines.end(); ++it) {
ostr << "\t" << *it << "\n";
}
Glib::RefPtr<Gtk::TextBuffer> buf = m_usage_lines_content.get_buffer();
buf->set_text(ostr.str());
}
void HelperPanel::setContext(const Glib::ustring &context) {
m_context.set_markup(_("<b>Context:</b> ")+context);
}
void HelperPanel::setExtractedComments(const Glib::ustring &extracted_comments) {
m_extracted_comments.set_markup(_("<b>Extracted notes:</b> ")+extracted_comments);
}
void HelperPanel::setComment(const Glib::ustring &comment) {
Glib::RefPtr<Gtk::TextBuffer> buf = m_comment_entry.get_buffer();
buf->set_text(comment);
}
Glib::ustring HelperPanel::getComment() {
Glib::RefPtr<Gtk::TextBuffer> buf = m_comment_entry.get_buffer();
return buf->get_text();
}