featgroup_config_panel.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: featgroup_config_panel.cpp,v $
- * PRODUCTION Revision 1000.0 2004/06/01 21:15:28 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.2
- * PRODUCTION
- * ===========================================================================
- */
- // generated by Fast Light User Interface Designer (fluid) version 1.0104
- #include <ncbi_pch.hpp>
- #include "featgroup_config_panel.hpp"
- BEGIN_NCBI_SCOPE
- #include "featgroup_config_panel_.cpp"
- CFeatGroupConfigPanel::CFeatGroupConfigPanel()
- {
- x_MakeWidgets();
- CTreeBrowser::Node* top_node = x_FillTree();
-
- x_TestInits();
- }
- void CFeatGroupConfigPanel::x_TestInits()
- {
- m_FeatGroups->add("Prime Dogma");
- m_FeatGroups->add("feature group 1");
- m_FeatGroups->add("feature group 2");
- m_FeatGroups->add("feature group 3");
- m_FeatGroups->add("all others");
- m_FeatGroups->deselect();
- m_FeatGroups->value(1);
- }
- Fl_Group* CFeatGroupConfigPanel::GetConfigPanel(void)
- {
- return m_ConfigPanel;
- }
- CTreeBrowser::Node* CFeatGroupConfigPanel::x_FillTree()
- {
- m_Tree->clear();
- m_Tree->insertion_mode(FLU_INSERT_BACK);
- m_Tree->selection_mode(FLU_SINGLE_SELECT);
-
- CFeatConfigItem rootItem;
- _ASSERT(m_FeatList.GetItem(objects::CSeqFeatData::e_not_set,
- objects::CSeqFeatData::eSubtype_any, rootItem));
- CTreeBrowser::Node* rootNode =
- m_Tree->set_root(rootItem.GetDescription().c_str());
- CTreeBrowser::Node* parent = rootNode;
- int current_type = objects::CSeqFeatData::e_not_set;
-
- // Fill up m_Tree with labels from m_FeatList
- ITERATE(CFeatConfigList, fc_it, m_FeatList) {
- // if done with a subcategory, popup.
- if (current_type != objects::CSeqFeatData::e_not_set &&
- current_type != fc_it->GetType() ) {
- parent = rootNode;
- current_type = objects::CSeqFeatData::e_not_set;
- }
- if (fc_it->GetSubtype() == objects::CSeqFeatData::eSubtype_any) {
- if (fc_it->GetType() == objects::CSeqFeatData::e_not_set) {
- continue; // already done.
- }
- //parent = m_Tree->add(fc_it->GetDescription().c_str(), true, 0, 0, rootNode);
- parent = m_Tree->AddChild(fc_it->GetDescription(), parent);
- parent->open(true);
- current_type = fc_it->GetType();
- } else {
- //m_Tree->add(fc_it->GetDescription().c_str(), false, 0, 0, parent);
- m_Tree->AddLeaf(fc_it->GetDescription(), parent);
- }
- }
-
- m_Tree->open(true);
- m_Tree->unselect_all();
-
- return rootNode;
- }
- void CFeatGroupConfigPanel::x_OnUp()
- {
- int current_pos = m_FeatGroups->value();
- if (current_pos == 0 || current_pos == 1)
- return;
-
- int new_pos = current_pos - 1;
- m_FeatGroups->move(current_pos, new_pos);
- m_FeatGroups->value(new_pos);
- m_FeatGroups->redraw();
- }
- void CFeatGroupConfigPanel::x_OnDown()
- {
- int current_pos = m_FeatGroups->value();
- if (current_pos == 0 || current_pos == m_FeatGroups->size())
- return;
-
- int new_pos = current_pos + 1;
- m_FeatGroups->move(current_pos, new_pos);
- m_FeatGroups->value(new_pos);
- m_FeatGroups->redraw();
- }
- void CFeatGroupConfigPanel::x_IntoGroup()
- {
- CTreeBrowser::Node* node = m_Tree->GetSelected();
- if (node) {
- m_FeatGroupItems->add(node->label());
- }
- }
- void CFeatGroupConfigPanel::x_OutofGroup()
- {
- int sel_item = m_FeatGroupItems->value();
- if (sel_item != 0) {
- m_FeatGroupItems->remove(sel_item);
- }
- }
- void CFeatGroupConfigPanel::x_OnFeatGroupClick()
- {
- int current_pos = m_FeatGroups->value();
- if (current_pos != 0) {
- const char *group_name = m_FeatGroups->text(current_pos);
- if (group_name != NULL) {
- m_CurrentGroupName->value(group_name);
- }
- }
- }
- void CFeatGroupConfigPanel::cbEnable(Fl_Widget* a, const Fl_Button* o)
- {
- if (o->value()) {
- a->activate();
- } else {
- a->deactivate();
- }
- }
- END_NCBI_SCOPE