/*
   Name   : mark_file()
   Purpose: Set the marked attribute in the file metadata record.
            Gets the first selected item for the file system tree
            widget and looks up the file metadata record.
   Input  : None.
   Output : None.
*/
void Fineline_File_System_Tree::mark_file()
{
	Fl_Tree_Item *flti = first_selected_item();
   fl_file_record_t *flrec = NULL;
   char file_path[FL_PATH_MAX]; // FL_PATH_MAX 2048 is an FLTK constant, Fineline FL_PATH_MAX_LENGTH 4096
   string full_path;

   if (flti != 0)
   {
      if (item_pathname(file_path, FL_PATH_MAX, flti) != 0)
      {
         Fineline_Log::print_log_entry("Fineline_File_System_Tree::mark_file() <ERROR> Could not get tree item path.");
         fl_message(" <ERROR> Could not get tree item. ");
         return;
      }

      full_path.append(file_path);
      flrec = find_file(full_path);
      if (flrec != NULL)
      {
         flrec->marked = 1;
         flti->labelcolor(FL_DARK_GREEN);
         flti->labelfont(FL_COURIER_BOLD);
         if (flrec->file_type == TSK_FS_META_TYPE_DIR) //If a directory then mark all the files in the directory.
         {
            mark_children(flti);
         }
         Fl::awake();
         Fineline_Log::print_log_entry("Fineline_File_System_Tree::mark_file() <INFO> marked file.");
      }
   }
   return;
}
void ModelerUserInterface::populateList(GroupProperty* group, Fl_Tree_Item* parent) {
	// Create a tree node for this group.
	Fl_Tree_Item* item;
	if (parent == NULL) {
		// HACK: We have to add and remove a fake list item so that the tree
		// control will create a root node to put it under.
		m_controlsTree->remove(m_controlsTree->add("You shouldn't see this."));

		item = m_controlsTree->root();
		item->label(group->getName());
	} else {
		item = m_controlsTree->add(parent, group->getName());
	}
	item->user_data(group);

	// Examine the group's property list for group properties.
	PropertyList* controls = group->getProperties();
	for (PropertyList::iterator iter = controls->begin();
		 iter != controls->end();
		 iter++) {
	    // See if it's a GroupProperty by attempting to cast it
		GroupProperty* childGroup = dynamic_cast<GroupProperty*>(*iter);

		// If it is, add it to the list.
		if (childGroup) {
			ModelerUserInterface::populateList(childGroup, item);
		}
	}
}
Exemple #3
0
void onelabGroup::addParameter(onelab::parameter &p)
{
  if(!p.getVisible() || CTX::instance()->solver.showInvisibleParameters) return;

  bool highlight = false;
  Fl_Color c;
  if(getFlColor(p.getAttribute("Highlight"), c)) highlight = true;
  Fl_Tree_Item *n = _tree->add(p.getName().c_str());
  if(!n) return;
  n->labelsize(FL_NORMAL_SIZE + 4);
  _tree->begin();
  int ww = _baseWidth - (n->depth() + 1) * _indent;
  ww *= _widgetLabelRatio; // FIXME CHANGE THIS
  int hh = n->labelsize() + 4;
  Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
  Fl_Widget *widget = _addParameterWidget(p, ww, hh, n, highlight, c);
  grp->end();
  if(!_enableTreeWidgetResize) grp->resizable(0);
  _treeWidgets.push_back(grp);
  widget->copy_label(p.getShortName().c_str());
  std::string help = p.getLabel().size() ? p.getLabel() : p.getShortName();
  if(p.getHelp().size()) help += ":\n" + p.getHelp();
  widget->copy_tooltip(help.c_str());
  n->widget(grp);
  _tree->end();
  if(p.getAttribute("Closed") == "1" && p.getPath().size()) _tree->close(p.getPath().c_str(), 0);
  _tree->redraw();
}
Exemple #4
0
/// Insert a new item into current item's children at a specified position.
Fl_Tree_Item *Fl_Tree_Item::insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos) {
    Fl_Tree_Item *item = new Fl_Tree_Item(prefs);
    item->label(new_label);
    item->_parent = this;
    _children.insert(pos, item);
    return(item);
}
Exemple #5
0
	void ShowModsGUI() {
		Fl_Double_Window* wind = make_mods_window();

		wind->callback([](Fl_Widget* window) {
			if(visible_callback) {
				visible_callback(false);
			}

			if(window) {
				delete (Fl_Double_Window*)window;
				mods_window = nullptr;
			}

			if(appended_ai_tree) {
				Fl_Tree_Item* first = appended_ai_tree->first();
				if(first) {
					for(int i = 0; i < first->children(); i++) {
						delete (int*)(first->child(i)->user_data());
					}
				}
				appended_ai_tree = nullptr;
			}
		});
		wind->show();

		visible_callback(true);
	}
Exemple #6
0
void onelabGroup::updateParameter(onelab::number &p)
{
  Fl_Tree_Item *n = _tree->find_item(p.getName().c_str());
  if(!n) {
    addParameter(p);
    return;
  }
  Fl_Group *grp = (Fl_Group *)n->widget();
  // enumeration (display choices as value labels, not numbers)
  if(p.getChoices().size() &&
     p.getChoices().size() == p.getValueLabels().size()){
    Fl_Choice *but = (Fl_Choice *)grp->child(0);
    //std::vector<Fl_Menu_Item> menu;
    //std::map<double, std::string> labels(p.getValueLabels());
    //for(std::map<double, std::string>::iterator it = labels.begin();
    //    it != labels.end(); it++){
    //  char *str = strdup(it->second.c_str());
    //  _treeStrings.push_back(str);
    //  Fl_Menu_Item menuItem = {str, 0, 0, 0, 0};
    //  if(highlight) menuItem.labelcolor(c);
    //  menu.push_back(menuItem);
    //}
    //Fl_Menu_Item it = {0};
    //menu.push_back(it);
    //but->copy(&menu[0]);
    for(unsigned int i = 0; i < p.getChoices().size(); i++){
      if(p.getValue() == p.getChoices()[i]){
        but->value(i);
        break;
      }
    }
    return;
  }

  // check box (boolean choice)
  if(p.getChoices().size() == 2 &&
     p.getChoices()[0] == 0 && p.getChoices()[1] == 1){
    Fl_Check_Button *but = (Fl_Check_Button *)grp->child(0);
    but->value(p.getValue());
    return;
  }

  // non-editable value FIXME
  if(p.getReadOnly()){
    outputRange *but = (outputRange *)grp->child(0);;
    but->value(p.getValue());
    but->graph(p.getAttribute("Graph"));
    return;
  }

  // general number input
  inputRange *but = (inputRange *)grp->child(0);
  but->value(p.getValue());
  but->minimum(p.getMin());
  but->maximum(p.getMax());
  but->step(p.getStep());
  but->choices(p.getChoices());
  but->loop(p.getAttribute("Loop"));
  but->graph(p.getAttribute("Graph"));
}
Exemple #7
0
void ResourceWindow::treeCallBack( Fl_Widget* widget, void* data )
{
	//LOG("Tree call back....");

	Fl_Tree      *tree = (Fl_Tree*)widget;
	Fl_Tree_Item *item = (Fl_Tree_Item*)tree->callback_item();	// get selected item
	ResourceWindow* window = (ResourceWindow*)data;
	if (tree->callback_reason() == FL_TREE_REASON_SELECTED)
	{
		std::stringstream strstr;
		strstr <<  window->getNameFromItem(item);
		long specialNameIndex = (long) item->user_data();
		if (specialNameIndex == 0) // assume any item with a special name doesn't need an additional label
			strstr << "/" << item->label();
			
		SBSelectionManager::getSelectionManager()->select(strstr.str());
	}	
	if (tree->callback_reason() == FL_TREE_REASON_DESELECTED)
	{
		std::stringstream strstr;
		strstr <<  window->getNameFromItem(item) << "/" << item->label();
			
		//SBSelectionManager::getSelectionManager()->select("");
	}
}
Exemple #8
0
void onelabGroup::updateParameter(onelab::string &p)
{
  Fl_Tree_Item *n = _tree->find_item(p.getName().c_str());
  if(!n) {
    addParameter(p);
    return;
  }
  Fl_Group *grp = (Fl_Group *)n->widget();
  // macro button
  if(p.getAttribute("Macro") == "Gmsh"){
    return;
  }

  // non-editable value FIXME
  if(p.getReadOnly()){
    Fl_Output *but = (Fl_Output *)grp->child(0);
    but->value(p.getValue().c_str());
    return;
  }

  // simple string (no menu)
  if(p.getChoices().empty() && p.getKind() != "file"){
    Fl_Input *but = (Fl_Input *)grp->child(0);
    but->value(p.getValue().c_str());
    return;
  }

  // general string input TODO
  Fl_Input_Choice *but = (Fl_Input_Choice *)grp->child(0);
  but->value(p.getValue().c_str());
}
Exemple #9
0
std::string ResourceWindow::getNameFromItem(Fl_Tree_Item* item)
{
	// find the item just under the root item
	std::string subname = "";
	Fl_Tree_Item* curItem = item;
	int numSubnames = 0;
	if (!curItem)
		return "";

	if (item == resourceTree->root())
		return "ROOT";

	while (curItem->parent() != resourceTree->root())
	{
		long specialNameIndex = (long) curItem->user_data();
		if (specialNameIndex > 0)
		{
			subname = "/" + _specialNames[specialNameIndex] + subname;
			numSubnames++;
		}
		curItem = curItem->parent();
	}

	return  getNameFromTree(curItem) + subname;
}
Exemple #10
0
void onelabGroup::openTreeItem(const std::string &name)
{
  Fl_Tree_Item *n = _tree->find_item(name.c_str());
  if(n && n->has_children()){
    n->open();
    _tree->redraw();
  }
}
void ModelerUserInterface::TreeCallback(Fl_Tree* tree, void* p) {
	if (tree->callback_reason() == FL_TREE_REASON_SELECTED) {
		Fl_Tree_Item *item = tree->callback_item();

		ModelerUserInterface::getInstance()->pickGroupProperty(
		(GroupProperty*) item->user_data());
	}
}
Exemple #12
0
void RtVarsTree::buildTree() {
	clear();
	if (p_CarState) {
		char buffer[64];
		buffer[sizeof(buffer)-1] = '\0';

		begin();

		// Can Values

		AnalogMapVarIterator v;
		AnalogMapGroupIterator g;

		for (g = p_CarState->analog_data.begin(); g != p_CarState->analog_data.end(); g++) {
			for (v = (*g).second.begin(); v != (*g).second.end(); v++) {
				Fl_Tree_Item *item;

				double physical_value;
				if ((*v).second.Signedness) {
					physical_value = (double)(int32_t)(*v).second.RawValue * (*v).second.Scale + (*v).second.Offset;
				} else {
					physical_value = (double)        (*v).second.RawValue * (*v).second.Scale + (*v).second.Offset;
				}

				snprintf(buffer, sizeof(buffer)-1, "%s/%s = %lu (%lf%s%s)",
					(*g).first.c_str(),
					(*v).first.c_str(),
					(long unsigned)(*v).second.RawValue,
					physical_value,
					(*v).second.Units[0] != '\0' ? " " : "",
					(*v).second.Units
				);

				item = add(buffer);
				item->user_data((void*)NULL);
				printf(">> %s\n", buffer);
			}
		}

		// Pwm Values
		PwmMapIterator p;
		for (p = p_CarState->pwm_data.begin(); p != p_CarState->pwm_data.end(); p++) {
				Fl_Tree_Item *item;
				snprintf(buffer, sizeof(buffer)-1, "PWM/%s = %lu of %lu (%.2lf%%)",
					(*p).first.c_str(),
					(long unsigned)(*p).second.PulseWidth,
					(long unsigned)(*p).second.Period,
					(long unsigned)(*p).second.Period == 0 ? 0.0 : 100.0 * (*p).second.getIntensity()
				);
				item = add(buffer);
				item->user_data((void*)NULL);
				printf(">> %s\n", buffer);
		}

		end();

	}
}
Exemple #13
0
static void copy_entity_name_cb(Fl_Widget*, void *s) {
	ObjectTree *self = (ObjectTree*)s;

	Fl_Tree_Item *titem = self->first_selected_item();
	if(!titem) return;

	const char *str = titem->label();
	if(str) Fl::copy(str, edelib_strnlen(str, 128), 1);
}
Exemple #14
0
void ResourceWindow::updatePath( Fl_Tree_Item* tree, const std::vector<std::string>& pathList )
{
	resourceTree->clear_children(tree);	
	for (size_t p = 0; p < pathList.size(); p++)
	{
		Fl_Tree_Item* item = resourceTree->add(tree, pathList[p].c_str());
		item->user_data(tree->user_data());
	}	
}
Exemple #15
0
void ResourceWindow::updateCharacter( Fl_Tree_Item* tree, SmartBody::SBCharacter* character )
{
	SmartBody::SBCharacter* sbcharacter = dynamic_cast<SmartBody::SBCharacter*>(character);
	Fl_Tree_Item* item = resourceTree->add(tree,character->getName().c_str());
	item->user_data((void*) addSpecialName(character->getName()));
	resourceTree->sortorder(FL_TREE_SORT_NONE);		
	Fl_Tree_Item* skeletonFolder = resourceTree->add(item,"skeleton");	
	skeletonFolder->user_data((void*) _reverseSpecialNames["skeleton"]); 
	SmartBody::SBSkeleton* sbSk = sbcharacter->getSkeleton();
	if (sbSk)
	{
		Fl_Tree_Item* charSkItem = resourceTree->add(skeletonFolder, sbSk->getName().c_str());
	}
	Fl_Tree_Item* controllerFolder = resourceTree->add(item,"controllers");	
	controllerFolder->user_data((void*) _reverseSpecialNames["controller"]); 
	controllerFolder->close();
	// add controllers
	MeControllerTreeRoot* ctTree = character->ct_tree_p ;
	if( ctTree )
	{
		int n = ctTree->count_controllers();
		for (int c = 0; c < n; c++)
		{
			//LOG( "%s", ctTree->controller(c)->name() );
			Fl_Tree_Item* ctrlItem = resourceTree->add(controllerFolder,ctTree->controller(c)->getName().c_str());
//			ctrlItem->user_data((void*)ITEM_CONTROLLER);
		}
	}
	/*
	// add gesture map
	Fl_Tree_Item* gestureFolder = resourceTree->add(item,"gestures");	
	gestureFolder->user_data((void*)-1);
	gestureFolder->close();
	// add individual gesture mappings
	SmartBody::SBScene* scene = SmartBody::SBScene::getScene();

	SBGestureMap* gestureMap = scene->getGestureMapManager()->getGestureMap(sbcharacter->getName());
	if (gestureMap)
	{
		std::string lexeme;
		std::string type;
		std::string hand;
		std::string style;
		std::string posture;

		gestureMap->getGestureByInfo(lexeme, type, hand, style, posture);
		Fl_Tree_Item* gestureItem = resourceTree->add(gestureFolder, lexeme.c_str());
		gestureItem->user_data((void*)ITEM_GESTUREMAP);
	}
	*/

	// add NVBG
	Fl_Tree_Item* nvbgItem = resourceTree->add(item, "minibrain");
	nvbgItem->user_data((void*) _reverseSpecialNames["minibrain"]); 
	SmartBody::Nvbg* nvbg = character->getNvbg();
	if (nvbg)
	{
		nvbgItem = resourceTree->add(item, nvbg->getName().c_str());
	}
}
Exemple #16
0
viewButton *onelabGroup::getViewButton(int num)
{
  char tmp[256];
  sprintf(tmp, "0Post-processing/View%d", num);
  Fl_Tree_Item *n = _tree->find_item(tmp);
  if(n){
    Fl_Group *grp = (Fl_Group*)n->widget();
    return (viewButton*)grp->child(0);
  }
  return 0;
}
Exemple #17
0
void ResourceWindow::showTree()
{
	// show everything under the top-level items
	Fl_Tree_Item* root = resourceTree->first();
	int numChildren = root->children();
	for (int c = 0; c < numChildren; c++)
	{
		Fl_Tree_Item* item = root->child(c);
		item->open();
	}
}
Exemple #18
0
void ResourceWindow::hideTree()
{
	// show only top-level items
	Fl_Tree_Item* root = resourceTree->first();
	int numChildren = root->children();
	for (int c = 0; c < numChildren; c++)
	{
		Fl_Tree_Item* item = root->child(c);
		item->close();
	}
}
Exemple #19
0
/// Insert a new item above this item.
Fl_Tree_Item *Fl_Tree_Item::insert_above(const Fl_Tree_Prefs &prefs, const char *new_label) {
    Fl_Tree_Item *p = _parent;
    if ( ! p ) return(0);
    // Walk our parent's children to find ourself
    for ( int t=0; t<p->children(); t++ ) {
        Fl_Tree_Item *c = p->child(t);
	if ( this == c ) {
	    return(p->insert(prefs, new_label, t));
	}
    }
    return(0);
}
Exemple #20
0
/// Add a new child to this item with the name 'new_label', with defaults from 'prefs'.
/// An internally managed copy is made of the label string.
/// Adds the item based on the value of prefs.sortorder().
///
Fl_Tree_Item *Fl_Tree_Item::add(const Fl_Tree_Prefs &prefs, const char *new_label) {
    Fl_Tree_Item *item = new Fl_Tree_Item(prefs);
    item->label(new_label);
    item->_parent = this;
    switch ( prefs.sortorder() ) {
        case FL_TREE_SORT_NONE: {
	    _children.add(item);
	    return(item);
	}
        case FL_TREE_SORT_ASCENDING: {
	    for ( int t=0; t<_children.total(); t++ ) {
	        Fl_Tree_Item *c = _children[t];
	        if ( c->label() && strcmp(c->label(), new_label) > 0 ) {
		    _children.insert(t, item);
		    return(item);
		}
	    }
	    _children.add(item);
	    return(item);
	}
        case FL_TREE_SORT_DESCENDING: {
	    for ( int t=0; t<_children.total(); t++ ) {
	        Fl_Tree_Item *c = _children[t];
	        if ( c->label() && strcmp(c->label(), new_label) < 0 ) {
		    _children.insert(t, item);
		    return(item);
		}
	    }
	    _children.add(item);
	    return(item);
	}
    }
    return(item);
}
Exemple #21
0
/// Descend into the path specified by \p arr, and add a new child there.
/// Should be used only by Fl_Tree's internals.
/// Adds the item based on the value of prefs.sortorder().
///
Fl_Tree_Item *Fl_Tree_Item::add(const Fl_Tree_Prefs &prefs, char **arr) {
    int t = find_child(*arr);
    Fl_Tree_Item *item;
    if ( t == -1 ) {
        item = (Fl_Tree_Item*)add(prefs, *arr);
    } else {
        item = (Fl_Tree_Item*)child(t);
    }
    if ( *(arr+1) ) {		// descend?
        return(item->add(prefs, arr+1));
    } else {
        return(item);		// end? done
    }
}
Exemple #22
0
void
frmPrjTree::tree_event(Fl_Widget* w, void* v)
{
   Fl_Tree *tree = static_cast<Fl_Tree*>(w);
   Fl_Tree_Item *item = tree->callback_item();    // the item changed (can be NULL if more than one item was changed!)
   switch ( tree->callback_reason() ) {           // reason callback was invoked
   case     FL_TREE_REASON_OPENED:
      printf("..item was opened..\n");
      break;
   case FL_TREE_REASON_CLOSED:
      printf("..item was closed..\n");
      break;
   case FL_TREE_REASON_SELECTED:
      frmmain->eventball.lastev=Q_DEL;
      frmmain->ehq_scene.top().Handle(&frmmain->eventball);
      frmmain->ehq_scene.top().clear();

      printf("..item was selected..\n");
      if(std::string(item->label()) == "View")
         frmviewctrl->select(true);
      else if(std::string(item->label()) == "Surface")
         frmsurfctrl->select(true);
      else if(std::string(item->label()) == "SFS Builder"){
         // select ui panel
         frmimageplane->select(true);
         // add event handler to the scene queue
         frmmain->ehq_scene.top().ins_top(&frmmain->dv->imageplane->eh);
         frmmain->eventball.lastev=Q_ADD;
         frmmain->dv->imageplane->eh.Handle(&frmmain->eventball);
      }
      else if(std::string(item->label()) == "Matting"){
         frmmatting->select(true);
         frmmain->ehq_scene.top().ins_top(&frmmain->dv->matting->eh);
         frmmain->eventball.lastev=Q_ADD;
         frmmain->dv->matting->eh.Handle(&frmmain->eventball);
      }

      break;
      //case FL_TREE_REASON_RESELECTED:
      //  printf("..item was reselected (double-clicked, etc)..\n");
      //     break;
   case FL_TREE_REASON_DESELECTED:
      if(std::string(item->label()) == "View")
         frmviewctrl->select(false);
      else if(std::string(item->label()) == "Surface")
         frmsurfctrl->select(false);
      else if(std::string(item->label()) == "SFS Builder")
         frmimageplane->select(false);
      else if(std::string(item->label()) == "Matting")
         frmmatting->select(false);
      printf("..item was deselected..\n");
      break;
   }
}
Exemple #23
0
static void send_to_editor_cb(Fl_Widget*, void *s) {
	ObjectTree *self = (ObjectTree*)s;
	Fl_Tree_Item *titem = self->first_selected_item();

	if(!titem || !titem->user_data()) return;

	Entity *en = (Entity*)titem->user_data();
	Fl_Text_Buffer *ebuf = self->get_editor_buffer();

	E_RETURN_IF_FAIL(ebuf != NULL);

	char buf[EDELIB_DBUS_EXPLORER_DEFAULT_SCRIPT_EVAL_BUFSIZE];
	if(en->get_prototype_as_scheme(buf, sizeof(buf)))
		ebuf->append(buf);
}
Exemple #24
0
void onelabGroup::_addSolverMenu(int num)
{
  std::ostringstream path;
  path << "0Solver/View" << num;
  Fl_Tree_Item *n = _tree->add(path.str().c_str());
  int ww = _baseWidth - (n->depth() + 1) * _indent;
  int hh = n->labelsize() + 4;
  _tree->begin();
  Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
  new solverButton(1, 1, ww, hh, num, _tree->color());
  grp->end();
  if(!_enableTreeWidgetResize) grp->resizable(0);
  _treeWidgets.push_back(grp);
  n->widget(grp);
  _tree->end();
}
void Fineline_File_System_Tree::assign_user_icons()
{
  static const char *L_folder_xpm[] = {
      "11 11 3 1",
      ".  c None",
      "x  c #d8d833",
      "@  c #808011",
      "...........",
      ".....@@@@..",
      "....@xxxx@.",
      "@@@@@xxxx@@",
      "@xxxxxxxxx@",
      "@xxxxxxxxx@",
      "@xxxxxxxxx@",
      "@xxxxxxxxx@",
      "@xxxxxxxxx@",
      "@xxxxxxxxx@",
      "@@@@@@@@@@@"};
  static Fl_Pixmap L_folderpixmap(L_folder_xpm);

   static const char *L_document_xpm[] = {
      "11 11 3 1",
      ".  c None",
      "x  c #d8d8f8",
      "@  c #202060",
      ".@@@@@@@@@.",
      ".@xxxxxxx@.",
      ".@xxxxxxx@.",
      ".@xxxxxxx@.",
      ".@xxxxxxx@.",
      ".@xxxxxxx@.",
      ".@xxxxxxx@.",
      ".@xxxxxxx@.",
      ".@xxxxxxx@.",
      ".@xxxxxxx@.",
      ".@@@@@@@@@."};
   static Fl_Pixmap L_documentpixmap(L_document_xpm);

  // Assign user icons to tree items
   for ( Fl_Tree_Item *item = first(); item; item=item->next())
   {
      item->usericon(item->has_children() ? &L_folderpixmap : &L_documentpixmap);
   }

}
void ModelerUserInterface::CurveTreeCallback(Fl_Tree* tree, void* p) {
	Fl_Tree_Item *item = tree->callback_item();

	// Only process leaf nodes.
	if (item->children()) {
		return;
	}

	// Determine how to change selection state.
	switch (tree->callback_reason()) {
	case FL_TREE_REASON_SELECTED:
		ModelerUserInterface::getInstance()->pickCurve((int)item->user_data(), true);
		break;
	case FL_TREE_REASON_DESELECTED:
		ModelerUserInterface::getInstance()->pickCurve((int)item->user_data(), false);
		break;
	}
}
Exemple #27
0
Fl_Tree_Item *movebookmark(const char *name) {

	static Fl_Double_Window *bookmove_win=(Fl_Double_Window *)0;
	static Fl_Box *bookmove_lbl=(Fl_Box *)0;
	static Fl_Tree *bookmove_tree = NULL;

	if (!bookmove_win) {
		bookmove_win = new Fl_Double_Window(430, 330, _("Move to directory"));
		{ bookmove_lbl = new Fl_Box(17, 10, 395, 30, _("Moving \"\""));
		} // Fl_Box* bookmove_lbl
		{ bookmove_tree = new Fl_Tree(17, 40, 395, 240);
		} // Fl_Input* bookmove_tree
		{ Fl_Button *o = new Fl_Button(45, 290, 130, 30, _("OK"));
			o->callback(bookmoveok_cb);
		} // Fl_Button* o
		{ Fl_Button *o = new Fl_Button(250, 290, 130, 30, _("Cancel"));
			o->callback(bookmovecancel_cb);
		} // Fl_Button* o
		bookmove_win->end();
	} // Fl_Double_Window* bookmove_win

	bookmove_win->user_data(NULL);

	char tmp[320];
	snprintf(tmp, 320, "Moving \"%s\"", name);
	tmp[319] = '\0';

	g->v->listdirs(bookmove_tree);
	bookmove_lbl->copy_label(tmp);

	bookmove_win->show();

	while (bookmove_win->shown())
		Fl::wait();

	if (!bookmove_win->user_data())
		return NULL;

	Fl_Tree_Item *picked = bookmove_tree->first_selected_item();
	if (!picked)
		return NULL;
	return (Fl_Tree_Item *) picked->user_data();
}
Exemple #28
0
void onelabGroup::_addViewMenu(int num)
{
  std::ostringstream path;
  path << "0Post-processing/View" << num;
  Fl_Tree_Item *n;
  if((n = _tree->find_item(path.str().c_str())) != NULL) { // check if the item already exists
    _tree->remove(n);
  }
  n = _tree->add(path.str().c_str());
  int ww = _baseWidth - (n->depth() + 1) * _indent;
  int hh = n->labelsize() + 4;
  _tree->begin();
  Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
  new viewButton(1, 1, ww, hh, num, _tree->color());
  grp->end();
  if(!_enableTreeWidgetResize) grp->resizable(0);
  _treeWidgets.push_back(grp);
  n->widget(grp);
  _tree->end();
}
void Fineline_File_System_Tree::unmark_children(Fl_Tree_Item *flti)
{
   Fl_Tree_Item *fltc;
   fl_file_record_t *flrec = NULL;
   char file_path[FL_PATH_MAX]; // FL_PATH_MAX 2048 is an FLTK constant, Fineline FL_PATH_MAX_LENGTH 4096
   string full_path;
   int ccount, i;

   if ((ccount = flti->children()) > 0)
   {
      for (i = 0; i < ccount; i++)
      {
         fltc = flti->child(i);
         if (fltc != 0)
         {
            if (item_pathname(file_path, FL_PATH_MAX, fltc) != 0)
            {
               Fineline_Log::print_log_entry("Fineline_File_System_Tree::unmark_children() <ERROR> Could not get tree item path.");
               fl_message(" <ERROR> Could not get tree item. ");
               return;
            }

            full_path = file_path;
            flrec = find_file(full_path);
            if (flrec != NULL)
            {
               flrec->marked = 0;
               fltc->labelcolor(FL_FOREGROUND_COLOR);
               fltc->labelfont(FL_HELVETICA);
               if (flrec->file_type == TSK_FS_META_TYPE_DIR) //If a directory then mark all the files in the directory.
               {
                  unmark_children(fltc);
               }
               Fl::awake();
               Fineline_Log::print_log_entry("Fineline_File_System_Tree::unmark_children() <INFO> unmarked file.");
            }
         }
      }
   }
}
Exemple #30
0
void onelabGroup::_addMenu(const std::string &path, Fl_Callback *callback, void *data)
{
  Fl_Tree_Item *n = _tree->add(path.c_str());
  _tree->begin();
  int ww = _baseWidth - (n->depth() + 1) * _indent;
  int hh = n->labelsize() + 4;
  Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
  Fl_Button *but = new Fl_Button(1, 1, ww, hh);
  but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
  but->callback(callback, data);
  but->box(FL_FLAT_BOX);
  but->color(_tree->color());
  but->selection_color(_tree->color());
  grp->end();
  if(!_enableTreeWidgetResize) grp->resizable(0);
  _treeWidgets.push_back(grp);
  std::string label = path;
  std::string::size_type last = path.find_last_of('/');
  if(last != std::string::npos) label = path.substr(last + 1);
  but->copy_label(label.c_str());
  n->widget(grp);
  _tree->end();
}