At the moment one has to specify the LineGroup as string. But one doesn't know what groups exist. So one has to check the Wiki, learn there where the groups are defined and then open the definition file with a text editor. This PR simplifies this by reading the existing groups out of the definition file and fill the combobox accordingly. It also give the user info what the selected LineGroup defines via the tooltip. A nice side effect is that no typos can occur since you don't have to enter the LineGroup name as text.
72 lines
2.8 KiB
C++
72 lines
2.8 KiB
C++
/***************************************************************************
|
|
* Copyright (c) 2017 WandererFan <wandererfan@gmail.com> *
|
|
* *
|
|
* This file is part of the FreeCAD CAx development system. *
|
|
* *
|
|
* This library is free software; you can redistribute it and/or *
|
|
* modify it under the terms of the GNU Library General Public *
|
|
* License as published by the Free Software Foundation; either *
|
|
* version 2 of the License, or (at your option) any later version. *
|
|
* *
|
|
* This library is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU Library General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU Library General Public *
|
|
* License along with this library; see the file COPYING.LIB. If not, *
|
|
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
|
* Suite 330, Boston, MA 02111-1307, USA *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
//! LineGroup - Classes related to processing LineGroup definition CSV files
|
|
|
|
#ifndef _TechDraw_LINEGROUP_H_
|
|
#define _TechDraw_LINEGROUP_H_
|
|
|
|
#include <string>
|
|
|
|
namespace TechDraw
|
|
{
|
|
|
|
class TechDrawExport LineGroup
|
|
{
|
|
public:
|
|
LineGroup();
|
|
LineGroup(std::string groupName);
|
|
~LineGroup();
|
|
double getWeight(std::string s);
|
|
void setWeight(std::string s, double weight);
|
|
// void setWeight(const char* s, double weight);
|
|
void dump(const char* title);
|
|
std::string getName(void) { return m_name; }
|
|
void setName(std::string s) { m_name = s; }
|
|
|
|
//static support function: split comma separated string of values into vector of numbers
|
|
static std::vector<double> split(std::string line);
|
|
|
|
//static support function: find group defn in file
|
|
static std::string getRecordFromFile(std::string parmFile, int groupNumber);
|
|
|
|
//static LineGroup maker
|
|
static LineGroup* lineGroupFactory(int groupNumber);
|
|
|
|
static double getDefaultWidth(std::string weightName, int groupNumber = -1);
|
|
|
|
static std::string getGroupNamesFromFile(std::string FileName);
|
|
|
|
|
|
protected:
|
|
void init(void);
|
|
|
|
std::string m_name;
|
|
double m_thin;
|
|
double m_graphic;
|
|
double m_thick;
|
|
double m_extra;
|
|
};
|
|
|
|
}
|
|
#endif
|