Changeset 835a0f


Ignore:
Timestamp:
Dec 16, 2009, 12:30:16 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
c68025
Parents:
a306a2
git-author:
Tillmann Crueger <crueger@…> (12/16/09 09:49:55)
git-committer:
Frederik Heber <heber@…> (12/16/09 12:30:16)
Message:

Added Title to DisplayMenuItems. Signed-off-by: Tillmann Crueger <crueger@…>

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Menu/DisplayMenuItem.cpp

    ra306a2 r835a0f  
    66 */
    77
     8#include <sstream>
     9#include <cmath>
     10
    811#include "Menu/DisplayMenuItem.hpp"
    912#include "Views/StringView.hpp"
    1013
    11 #include <iostream>
    1214
    1315DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view):
    1416MenuItem('\0',"",_menu),
    15 view(_view)
     17view(_view),
     18title("")
    1619{
     20}
    1721
     22DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view, string _title, char _spacer, int _length ):
     23MenuItem('\0',"",_menu),
     24view(_view),
     25title(_title),
     26spacer(_spacer),
     27length(_length)
     28{
    1829}
    1930
     
    2839
    2940const string DisplayMenuItem::formatEntry(){
    30   return view->toString();
     41  stringstream s;
     42  if(title.length()>0) {
     43    int pre = floor((length-title.length())/2.0);
     44    int post = ceil((length-title.length())/2.0);
     45    for(int i=0;i<pre;i++)
     46      s << spacer;
     47    s << title;
     48    for(int i=0;i<post;i++)
     49          s << spacer;
     50    s << "\n";
     51  }
     52  s << view->toString();
     53  return s.str();
    3154}
    3255
  • src/Menu/DisplayMenuItem.hpp

    ra306a2 r835a0f  
    1010
    1111#include "Menu/MenuItem.hpp"
     12#include "defs.hpp"
    1213
    1314class StringView;
     
    1718public:
    1819  DisplayMenuItem(Menu* _menu, StringView *_view);
     20  DisplayMenuItem(Menu* _menu, StringView *_view, string _title,
     21                  char _spacer=STD_MENU_TITLE_SPACER, int _length=STD_MENU_LENGTH);
    1922  virtual ~DisplayMenuItem();
    2023
     
    2831private:
    2932  StringView *view;
     33  string title;
     34  int length;
     35  char spacer;
    3036};
    3137
  • src/menu.cpp

    ra306a2 r835a0f  
    12291229
    12301230  StringView *moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,molecules,_1));
    1231   new DisplayMenuItem(main_menu,moleculeView);
     1231  new DisplayMenuItem(main_menu,moleculeView,"Molecule List");
    12321232
    12331233  new SeperatorItem(main_menu);
  • src/moleculelist.cpp

    ra306a2 r835a0f  
    142142
    143143  // header
    144   Log() << Verbose(0) << "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl;
    145   Log() << Verbose(0) << "-----------------------------------------------" << endl;
     144  (*out) << "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl;
     145  (*out) << "-----------------------------------------------" << endl;
    146146  if (ListOfMolecules.size() == 0)
    147     Log() << Verbose(0) << "\tNone" << endl;
     147    (*out) << "\tNone" << endl;
    148148  else {
    149149    Origin.Zero();
     
    162162      }
    163163      // output Index, Name, number of atoms, chemical formula
    164       Log() << Verbose(0) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t";
     164      (*out) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t";
    165165      Elemental = (*ListRunner)->elemente->end;
    166166      while(Elemental->previous != (*ListRunner)->elemente->start) {
    167167        Elemental = Elemental->previous;
    168168        if (Counts[Elemental->Z] != 0)
    169           Log() << Verbose(0) << Elemental->symbol << Counts[Elemental->Z];
     169          (*out) << Elemental->symbol << Counts[Elemental->Z];
    170170      }
    171171      // Center and size
    172       Log() << Verbose(0) << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl;
     172      (*out) << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl;
    173173    }
    174174  }
Note: See TracChangeset for help on using the changeset viewer.