mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Instead of the new_intrusive<T>() functions, use intrusive(new T)
This means we no longer need 8 different functions for different numbers of arguments, and non-const references can now also be passed to constructors without problems. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1443 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -231,7 +231,7 @@ void AutoReplaceWindow::onRemove(wxCommandEvent&) {
|
||||
list->removeSelected();
|
||||
}
|
||||
void AutoReplaceWindow::onAdd(wxCommandEvent&) {
|
||||
list->addItem(new_intrusive<AutoReplace>());
|
||||
list->addItem(intrusive(new AutoReplace()));
|
||||
}
|
||||
void AutoReplaceWindow::onDefault(wxCommandEvent&) {
|
||||
use_auto_replace->SetValue(true);
|
||||
|
||||
+22
-22
@@ -1019,39 +1019,39 @@ void GraphControl::setLayout(GraphType type, bool force) {
|
||||
switch (type) {
|
||||
case GRAPH_TYPE_BAR: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
combined->add(new_intrusive2<GraphValueAxis>(0, true));
|
||||
combined->add(new_intrusive2<GraphLabelAxis>(0, HORIZONTAL));
|
||||
combined->add(new_intrusive1<BarGraph>(0));
|
||||
combined->add(new_intrusive2<GraphStats>(0, ALIGN_TOP_RIGHT));
|
||||
graph = new_intrusive5<GraphWithMargins>(combined, 23,8,7,20);
|
||||
combined->add(intrusive(new GraphValueAxis(0, true)));
|
||||
combined->add(intrusive(new GraphLabelAxis(0, HORIZONTAL)));
|
||||
combined->add(intrusive(new BarGraph(0)));
|
||||
combined->add(intrusive(new GraphStats(0, ALIGN_TOP_RIGHT)));
|
||||
graph = intrusive(new GraphWithMargins(combined, 23,8,7,20));
|
||||
break;
|
||||
} case GRAPH_TYPE_PIE: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
combined->add(new_intrusive5<GraphWithMargins>(new_intrusive1<PieGraph>(0), 0,0,120,0));
|
||||
combined->add(new_intrusive3<GraphLegend>(0, ALIGN_TOP_RIGHT, false));
|
||||
graph = new_intrusive5<GraphWithMargins>(combined, 20,20,20,20);
|
||||
combined->add(intrusive(new GraphWithMargins(intrusive(new PieGraph(0)), 0,0,120,0)));
|
||||
combined->add(intrusive(new GraphLegend(0, ALIGN_TOP_RIGHT, false)));
|
||||
graph = intrusive(new GraphWithMargins(combined, 20,20,20,20));
|
||||
break;
|
||||
} case GRAPH_TYPE_STACK: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
combined->add(new_intrusive2<GraphValueAxis>(0, false));
|
||||
combined->add(new_intrusive2<GraphLabelAxis>(0, HORIZONTAL));
|
||||
combined->add(new_intrusive2<BarGraph2D>(0,1));
|
||||
combined->add(new_intrusive3<GraphLegend>(1, ALIGN_TOP_RIGHT, true));
|
||||
graph = new_intrusive5<GraphWithMargins>(combined, 23,8,7,20);
|
||||
combined->add(intrusive(new GraphValueAxis(0, false)));
|
||||
combined->add(intrusive(new GraphLabelAxis(0, HORIZONTAL)));
|
||||
combined->add(intrusive(new BarGraph2D(0,1)));
|
||||
combined->add(intrusive(new GraphLegend(1, ALIGN_TOP_RIGHT, true)));
|
||||
graph = intrusive(new GraphWithMargins(combined, 23,8,7,20));
|
||||
break;
|
||||
} case GRAPH_TYPE_SCATTER: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
combined->add(new_intrusive4<GraphLabelAxis>(0, HORIZONTAL, false, DRAW_LINES_MID));
|
||||
combined->add(new_intrusive4<GraphLabelAxis>(1, VERTICAL, false, DRAW_LINES_MID));
|
||||
combined->add(new_intrusive2<ScatterGraph>(0,1));
|
||||
graph = new_intrusive5<GraphWithMargins>(combined, 80,8,7,20);
|
||||
combined->add(intrusive(new GraphLabelAxis(0, HORIZONTAL, false, DRAW_LINES_MID)));
|
||||
combined->add(intrusive(new GraphLabelAxis(1, VERTICAL, false, DRAW_LINES_MID)));
|
||||
combined->add(intrusive(new ScatterGraph(0,1)));
|
||||
graph = intrusive(new GraphWithMargins(combined, 80,8,7,20));
|
||||
break;
|
||||
} case GRAPH_TYPE_SCATTER_PIE: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
combined->add(new_intrusive4<GraphLabelAxis>(0, HORIZONTAL, false, DRAW_LINES_MID));
|
||||
combined->add(new_intrusive4<GraphLabelAxis>(1, VERTICAL, false, DRAW_LINES_MID));
|
||||
combined->add(new_intrusive3<ScatterPieGraph>(0,1,2));
|
||||
graph = new_intrusive5<GraphWithMargins>(combined, 80,8,7,20);
|
||||
combined->add(intrusive(new GraphLabelAxis(0, HORIZONTAL, false, DRAW_LINES_MID)));
|
||||
combined->add(intrusive(new GraphLabelAxis(1, VERTICAL, false, DRAW_LINES_MID)));
|
||||
combined->add(intrusive(new ScatterPieGraph(0,1,2)));
|
||||
graph = intrusive(new GraphWithMargins(combined, 80,8,7,20));
|
||||
break;
|
||||
} default:
|
||||
graph = GraphP();
|
||||
@@ -1065,7 +1065,7 @@ GraphType GraphControl::getLayout() const {
|
||||
}
|
||||
|
||||
void GraphControl::setData(const GraphDataPre& data) {
|
||||
setData(new_intrusive1<GraphData>(data));
|
||||
setData(intrusive(new GraphData(data)));
|
||||
}
|
||||
void GraphControl::setData(const GraphDataP& data) {
|
||||
if (graph) {
|
||||
|
||||
@@ -100,7 +100,7 @@ int ImageCardList::OnGetItemImage(long pos) const {
|
||||
return it->second;
|
||||
} else {
|
||||
// request a thumbnail
|
||||
thumbnail_thread.request(new_intrusive2<CardThumbnailRequest>(const_cast<ImageCardList*>(this), val.filename));
|
||||
thumbnail_thread.request(intrusive(new CardThumbnailRequest(const_cast<ImageCardList*>(this), val.filename)));
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
@@ -64,7 +64,7 @@ void TextCtrl::updateSize() {
|
||||
}
|
||||
|
||||
void TextCtrl::setValue(String* value, bool untagged) {
|
||||
setValue(new_intrusive4<FakeTextValue>(getFieldP(), value, true, untagged));
|
||||
setValue(intrusive(new FakeTextValue(getFieldP(), value, true, untagged)));
|
||||
}
|
||||
void TextCtrl::setValue(const FakeTextValueP& value) {
|
||||
value->retrieve();
|
||||
|
||||
@@ -32,7 +32,7 @@ HtmlExportWindow::HtmlExportWindow(Window* parent, const SetP& set, const Export
|
||||
// init controls
|
||||
list = new PackageList(this, ID_EXPORT_LIST);
|
||||
options = new ExportOptionsEditor(this, wxID_ANY, wxNO_BORDER);
|
||||
options->setSet(new_intrusive1<Set>(set->stylesheet)); // dummy set
|
||||
options->setSet(intrusive(new Set(set->stylesheet))); // dummy set
|
||||
// init sizers
|
||||
wxSizer* s = new wxBoxSizer(wxVERTICAL);
|
||||
s->Add(new wxStaticText(this, wxID_ANY, _LABEL_("html template")), 0, wxALL, 4);
|
||||
|
||||
@@ -91,7 +91,7 @@ void NewSetWindow::OnOK(wxCommandEvent&) {
|
||||
void NewSetWindow::done() {
|
||||
try {
|
||||
StyleSheetP stylesheet = stylesheet_list->getSelection<StyleSheet>();
|
||||
set = new_intrusive1<Set>(stylesheet);
|
||||
set = intrusive(new Set(stylesheet));
|
||||
set->validate();
|
||||
EndModal(wxID_OK);
|
||||
} catch (const Error& e) {
|
||||
|
||||
@@ -227,7 +227,7 @@ void PackageUpdateList::initItems() {
|
||||
ti.setIcon(load_resource_image(_("installer_package")));
|
||||
if (!p->description->icon_url.empty()) {
|
||||
// download icon
|
||||
thumbnail_thread.request(new_intrusive2<PackageIconRequest>(this,&ti));
|
||||
thumbnail_thread.request(intrusive(new PackageIconRequest(this,&ti)));
|
||||
}
|
||||
} else if (ti.position_type == TreeItem::TYPE_LOCALE) { // locale folder
|
||||
ti.setIcon(load_resource_image(_("installer_locales")));
|
||||
|
||||
@@ -214,7 +214,7 @@ PackagesWindow::PackagesWindow(Window* parent, const InstallerP& installer)
|
||||
{
|
||||
init(parent, true);
|
||||
// add installer
|
||||
merge(installable_packages, new_intrusive1<DownloadableInstaller>(installer));
|
||||
merge(installable_packages, intrusive(new DownloadableInstaller(installer)));
|
||||
FOR_EACH(p, installable_packages) p->determineStatus();
|
||||
// mark all packages in the installer for installation
|
||||
FOR_EACH(ip, installable_packages) {
|
||||
@@ -353,7 +353,7 @@ void PackagesWindow::onOk(wxCommandEvent& ev) {
|
||||
os.Write(*is);
|
||||
os.Close();
|
||||
// open installer
|
||||
ip->installer->installer = new_intrusive<Installer>();
|
||||
ip->installer->installer = intrusive(new Installer());
|
||||
ip->installer->installer->open(ip->installer->installer_file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void TextBufferDC::DoDrawText(const String& str, int x, int y) {
|
||||
if (buffer_text) {
|
||||
double usx,usy;
|
||||
GetUserScale(&usx, &usy);
|
||||
text.push_back( new_intrusive7<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str) );
|
||||
text.push_back( intrusive(new TextDraw(GetFont(), GetTextForeground(), usx, usy, x, y, str)) );
|
||||
} else {
|
||||
wxMemoryDC::DoDrawText(str,x,y);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ void TextBufferDC::DoDrawRotatedText(const String& str, int x, int y, double ang
|
||||
if (buffer_text) {
|
||||
double usx,usy;
|
||||
GetUserScale(&usx, &usy);
|
||||
text.push_back( new_intrusive8<TextDraw>(GetFont(), GetTextForeground(), usx, usy, x, y, str, angle) );
|
||||
text.push_back( intrusive(new TextDraw(GetFont(), GetTextForeground(), usx, usy, x, y, str, angle)) );
|
||||
} else {
|
||||
wxMemoryDC::DoDrawRotatedText(str,x,y,angle);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void CardsPrintout::OnPreparePrinting() {
|
||||
int pw_mm, ph_mm;
|
||||
GetPageSizeMM(&pw_mm, &ph_mm);
|
||||
if (!layout) {
|
||||
layout = new_intrusive2<PageLayout>(*set->stylesheet, RealSize(pw_mm, ph_mm));
|
||||
layout = intrusive(new PageLayout(*set->stylesheet, RealSize(pw_mm, ph_mm)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -326,9 +326,9 @@ void KeywordsPanel::onKeywordSelect(KeywordSelectEvent& ev) {
|
||||
if (ev.keyword) {
|
||||
Keyword& kw = *ev.keyword;
|
||||
sp->Show(fixed, kw.fixed);
|
||||
keyword ->setValue(new_intrusive5<KeywordTextValue> (keyword->getFieldP(), &kw, &kw.keyword, !kw.fixed, true));
|
||||
match ->setValue(new_intrusive4<KeywordTextValue> (match->getFieldP(), &kw, &kw.match, !kw.fixed));
|
||||
rules ->setValue(new_intrusive4<KeywordTextValue> (rules->getFieldP(), &kw, &kw.rules, !kw.fixed));
|
||||
keyword ->setValue(intrusive(new KeywordTextValue(keyword->getFieldP(), &kw, &kw.keyword, !kw.fixed, true)));
|
||||
match ->setValue(intrusive(new KeywordTextValue(match->getFieldP(), &kw, &kw.match, !kw.fixed)));
|
||||
rules ->setValue(intrusive(new KeywordTextValue(rules->getFieldP(), &kw, &kw.rules, !kw.fixed)));
|
||||
intrusive_ptr<KeywordReminderTextValue> reminder_value(new KeywordReminderTextValue(*set, reminder->getFieldP(), &kw, !kw.fixed));
|
||||
reminder->setValue(reminder_value);
|
||||
errors->SetLabel(reminder_value->errors);
|
||||
|
||||
@@ -387,14 +387,14 @@ void CustomPackDialog::updateTotals() {
|
||||
}
|
||||
|
||||
void CustomPackDialog::storePack() {
|
||||
edited_pack = new_intrusive<PackType>();
|
||||
edited_pack = intrusive(new PackType());
|
||||
edited_pack->selectable = true;
|
||||
edited_pack->select = SELECT_ALL;
|
||||
edited_pack->name = name->GetValue();
|
||||
FOR_EACH(pick,pickers) {
|
||||
int copies = pick.value->GetValue();
|
||||
if (copies > 0) {
|
||||
edited_pack->items.push_back(new_intrusive2<PackItem>(pick.pack->name, copies));
|
||||
edited_pack->items.push_back(intrusive(new PackItem(pick.pack->name, copies)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -725,10 +725,10 @@ void RandomPackPanel::onCardSelect(CardSelectEvent& ev) {
|
||||
|
||||
void RandomPackPanel::selectionChoices(ExportCardSelectionChoices& out) {
|
||||
if (!isInitialized()) return;
|
||||
out.push_back(new_intrusive2<ExportCardSelectionChoice>(
|
||||
out.push_back(intrusive(new ExportCardSelectionChoice(
|
||||
_BUTTON_("export generated packs"),
|
||||
card_list->getCardsPtr()
|
||||
));
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -470,7 +470,7 @@ void StatsPanel::showCategory(const GraphType* prefer_layout) {
|
||||
// create axes
|
||||
GraphDataPre d;
|
||||
FOR_EACH(dim, dims) {
|
||||
d.axes.push_back(new_intrusive6<GraphAxis>(
|
||||
d.axes.push_back(intrusive(new GraphAxis(
|
||||
dim->name,
|
||||
dim->colors.empty() ? AUTO_COLOR_EVEN : AUTO_COLOR_NO,
|
||||
dim->numeric,
|
||||
@@ -478,7 +478,7 @@ void StatsPanel::showCategory(const GraphType* prefer_layout) {
|
||||
&dim->colors,
|
||||
dim->groups.empty() ? nullptr : &dim->groups
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
// find values for each card
|
||||
for (size_t i = 0 ; i < set->cards.size() ; ++i) {
|
||||
|
||||
@@ -263,7 +263,7 @@ void SetWindow::onChangeSet() {
|
||||
updateTitle();
|
||||
// make sure there is always at least one card
|
||||
// some things need this
|
||||
if (set->cards.empty()) set->cards.push_back(new_intrusive1<Card>(*set->game));
|
||||
if (set->cards.empty()) set->cards.push_back(intrusive(new Card(*set->game)));
|
||||
// all panels view the same set
|
||||
FOR_EACH(p, panels) {
|
||||
p->setSet(set);
|
||||
@@ -337,11 +337,11 @@ void SetWindow::onCardActivate(CardSelectEvent& ev) {
|
||||
}
|
||||
|
||||
void SetWindow::selectionChoices(ExportCardSelectionChoices& out) {
|
||||
out.push_back(new_intrusive1<ExportCardSelectionChoice>(*set)); // entire set
|
||||
out.push_back(intrusive(new ExportCardSelectionChoice(*set))); // entire set
|
||||
FOR_EACH(p, panels) {
|
||||
p->selectionChoices(out);
|
||||
}
|
||||
out.push_back(new_intrusive<ExportCardSelectionChoice>()); // custom
|
||||
out.push_back(intrusive(new ExportCardSelectionChoice())); // custom
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Window events - close
|
||||
|
||||
@@ -186,7 +186,7 @@ void SymbolBasicShapeEditor::makeShape(Vector2D a, Vector2D b, bool constrained,
|
||||
|
||||
// TODO : Move out of this class
|
||||
void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bool constrained) {
|
||||
shape = new_intrusive<SymbolShape>();
|
||||
shape = intrusive(new SymbolShape);
|
||||
// What shape to make?
|
||||
switch (mode) {
|
||||
case ID_SHAPE_CIRCLE: {
|
||||
@@ -199,10 +199,10 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
|
||||
// a circle has 4 control points, the first is: (x+r, y) db(0, kr) da(0, -kr)
|
||||
// kr is a magic constant
|
||||
const double kr = 0.5522847498f; // = 4/3 * (sqrt(2) - 1)
|
||||
shape->points.push_back(new_intrusive7<ControlPoint>(c.x + r.x, c.y, 0, kr * r.y, 0, -kr * r.y, LOCK_SIZE));
|
||||
shape->points.push_back(new_intrusive7<ControlPoint>(c.x, c.y - r.y, kr * r.x, 0, -kr * r.x, 0, LOCK_SIZE));
|
||||
shape->points.push_back(new_intrusive7<ControlPoint>(c.x - r.x, c.y, 0, -kr * r.y, 0, kr * r.y, LOCK_SIZE));
|
||||
shape->points.push_back(new_intrusive7<ControlPoint>(c.x, c.y + r.y, -kr * r.x, 0, kr * r.x, 0, LOCK_SIZE));
|
||||
shape->points.push_back(intrusive(new ControlPoint(c.x + r.x, c.y, 0, kr * r.y, 0, -kr * r.y, LOCK_SIZE)));
|
||||
shape->points.push_back(intrusive(new ControlPoint(c.x, c.y - r.y, kr * r.x, 0, -kr * r.x, 0, LOCK_SIZE)));
|
||||
shape->points.push_back(intrusive(new ControlPoint(c.x - r.x, c.y, 0, -kr * r.y, 0, kr * r.y, LOCK_SIZE)));
|
||||
shape->points.push_back(intrusive(new ControlPoint(c.x, c.y + r.y, -kr * r.x, 0, kr * r.x, 0, LOCK_SIZE)));
|
||||
break;
|
||||
} case ID_SHAPE_RECTANGLE: {
|
||||
// A rectangle / square
|
||||
@@ -212,10 +212,10 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
|
||||
shape->name = capitalize(_TYPE_("rectangle"));
|
||||
}
|
||||
// a rectangle just has four corners
|
||||
shape->points.push_back(new_intrusive2<ControlPoint>(c.x - r.x, c.y - r.y));
|
||||
shape->points.push_back(new_intrusive2<ControlPoint>(c.x + r.x, c.y - r.y));
|
||||
shape->points.push_back(new_intrusive2<ControlPoint>(c.x + r.x, c.y + r.y));
|
||||
shape->points.push_back(new_intrusive2<ControlPoint>(c.x - r.x, c.y + r.y));
|
||||
shape->points.push_back(intrusive(new ControlPoint(c.x - r.x, c.y - r.y)));
|
||||
shape->points.push_back(intrusive(new ControlPoint(c.x + r.x, c.y - r.y)));
|
||||
shape->points.push_back(intrusive(new ControlPoint(c.x + r.x, c.y + r.y)));
|
||||
shape->points.push_back(intrusive(new ControlPoint(c.x - r.x, c.y + r.y)));
|
||||
break;
|
||||
} default: {
|
||||
// A polygon or star
|
||||
@@ -258,10 +258,10 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
|
||||
// we can generate points
|
||||
for(int i = 0 ; i < n ; ++i) {
|
||||
double theta = alpha * i;
|
||||
shape->points.push_back(new_intrusive2<ControlPoint>(
|
||||
shape->points.push_back(intrusive(new ControlPoint(
|
||||
c.x + ra * r.x * sin(theta),
|
||||
y - ra * r.y * cos(theta)
|
||||
));
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
// a star is made using a smaller, inverted polygon at the inside
|
||||
@@ -280,16 +280,16 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo
|
||||
for(int i = 0 ; i < n ; ++i) {
|
||||
double theta = alpha * i;
|
||||
// from a
|
||||
shape->points.push_back(new_intrusive2<ControlPoint>(
|
||||
shape->points.push_back(intrusive(new ControlPoint(
|
||||
c.x + ra * r.x * sin(theta),
|
||||
y - ra * r.y * cos(theta)
|
||||
));
|
||||
)));
|
||||
// from b
|
||||
theta = alpha * (i + 0.5);
|
||||
shape->points.push_back(new_intrusive2<ControlPoint>(
|
||||
shape->points.push_back(intrusive(new ControlPoint(
|
||||
c.x + rb * r.x * sin(theta),
|
||||
y - rb * r.y * cos(theta)
|
||||
));
|
||||
)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+10
-10
@@ -39,23 +39,23 @@ void SymbolControl::switchEditor(const SymbolEditorBaseP& e) {
|
||||
|
||||
void SymbolControl::onChangeSymbol() {
|
||||
selected_parts.setSymbol(symbol);
|
||||
switchEditor(new_intrusive2<SymbolSelectEditor>(this, false));
|
||||
switchEditor(intrusive(new SymbolSelectEditor(this, false)));
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void SymbolControl::onModeChange(wxCommandEvent& ev) {
|
||||
switch (ev.GetId()) {
|
||||
case ID_MODE_SELECT:
|
||||
switchEditor(new_intrusive2<SymbolSelectEditor>(this, false));
|
||||
switchEditor(intrusive(new SymbolSelectEditor(this, false)));
|
||||
break;
|
||||
case ID_MODE_ROTATE:
|
||||
switchEditor(new_intrusive2<SymbolSelectEditor>(this, true));
|
||||
switchEditor(intrusive(new SymbolSelectEditor(this, true)));
|
||||
break;
|
||||
case ID_MODE_POINTS:
|
||||
if (selected_parts.size() == 1) {
|
||||
selected_shape = selected_parts.getAShape();
|
||||
if (selected_shape) {
|
||||
switchEditor(new_intrusive2<SymbolPointEditor>(this, selected_shape));
|
||||
switchEditor(intrusive(new SymbolPointEditor(this, selected_shape)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -64,10 +64,10 @@ void SymbolControl::onModeChange(wxCommandEvent& ev) {
|
||||
selected_parts.clear();
|
||||
signalSelectionChange();
|
||||
}
|
||||
switchEditor(new_intrusive1<SymbolBasicShapeEditor>(this));
|
||||
switchEditor(intrusive(new SymbolBasicShapeEditor(this)));
|
||||
break;
|
||||
case ID_MODE_SYMMETRY:
|
||||
switchEditor(new_intrusive2<SymbolSymmetryEditor>(this, selected_parts.getASymmetry()));
|
||||
switchEditor(intrusive(new SymbolSymmetryEditor(this, selected_parts.getASymmetry())));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ void SymbolControl::onUpdateSelection() {
|
||||
}
|
||||
// begin editing another part
|
||||
selected_shape = shape;
|
||||
editor = new_intrusive2<SymbolPointEditor>(this, selected_shape);
|
||||
editor = intrusive(new SymbolPointEditor(this, selected_shape));
|
||||
Refresh(false);
|
||||
}
|
||||
break;
|
||||
@@ -147,17 +147,17 @@ void SymbolControl::onUpdateSelection() {
|
||||
|
||||
void SymbolControl::selectPart(const SymbolPartP& part) {
|
||||
selected_parts.select(part);
|
||||
switchEditor(new_intrusive2<SymbolSelectEditor>(this, false));
|
||||
switchEditor(intrusive(new SymbolSelectEditor(this, false)));
|
||||
signalSelectionChange();
|
||||
}
|
||||
|
||||
void SymbolControl::activatePart(const SymbolPartP& part) {
|
||||
if (part->isSymbolShape()) {
|
||||
selected_parts.select(part);
|
||||
switchEditor(new_intrusive2<SymbolPointEditor>(this, static_pointer_cast<SymbolShape>(part)));
|
||||
switchEditor(intrusive(new SymbolPointEditor(this, static_pointer_cast<SymbolShape>(part))));
|
||||
} else if (part->isSymbolSymmetry()) {
|
||||
selected_parts.select(part);
|
||||
switchEditor(new_intrusive2<SymbolSymmetryEditor>(this, static_pointer_cast<SymbolSymmetry>(part)));
|
||||
switchEditor(intrusive(new SymbolSymmetryEditor(this, static_pointer_cast<SymbolSymmetry>(part))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ void SymbolSelectEditor::onCommand(int id) {
|
||||
control.Refresh(false);
|
||||
} else if (id == ID_EDIT_GROUP && !isEditing()) {
|
||||
// group selection, not when dragging
|
||||
addAction(new GroupSymbolPartsAction(*getSymbol(), control.selected_parts.get(), new_intrusive<SymbolGroup>()));
|
||||
addAction(new GroupSymbolPartsAction(*getSymbol(), control.selected_parts.get(), intrusive(new SymbolGroup())));
|
||||
control.Refresh(false);
|
||||
} else if (id == ID_EDIT_UNGROUP && !isEditing()) {
|
||||
// ungroup selection, not when dragging
|
||||
|
||||
@@ -118,7 +118,7 @@ void SymbolSymmetryEditor::onCommand(int id) {
|
||||
}
|
||||
resetActions();
|
||||
} else if (id == ID_ADD_SYMMETRY) {
|
||||
symmetry = new_intrusive<SymbolSymmetry>();
|
||||
symmetry = intrusive(new SymbolSymmetry());
|
||||
symmetry->kind = SYMMETRY_ROTATION;
|
||||
symmetry->copies = 2;
|
||||
symmetry->center = Vector2D(0.5,0.5);
|
||||
|
||||
@@ -35,7 +35,7 @@ SymbolWindow::SymbolWindow(Window* parent, const String& filename)
|
||||
: performer(nullptr)
|
||||
{
|
||||
// open file
|
||||
Reader reader(new_shared1<wxFileInputStream>(filename), nullptr, filename);
|
||||
Reader reader(shared(new wxFileInputStream(filename)), nullptr, filename);
|
||||
SymbolP symbol;
|
||||
reader.handle_greedy(symbol);
|
||||
init(parent, symbol);
|
||||
@@ -216,7 +216,7 @@ void SymbolWindow::onFileOpen(wxCommandEvent& ev) {
|
||||
String ext = n.GetExt();
|
||||
SymbolP symbol;
|
||||
if (ext.Lower() == _("mse-symbol")) {
|
||||
Reader reader(new_shared1<wxFileInputStream>(name), nullptr, name);
|
||||
Reader reader(shared(new wxFileInputStream(name)), nullptr, name);
|
||||
reader.handle_greedy(symbol);
|
||||
} else {
|
||||
wxBusyCursor busy;
|
||||
@@ -239,7 +239,7 @@ void SymbolWindow::onFileSaveAs(wxCommandEvent& ev) {
|
||||
String name = wxFileSelector(_("Save symbol"),settings.default_set_dir,_(""),_(""),_("Symbol files (*.mse-symbol)|*.mse-symbol"),wxSAVE, this);
|
||||
if (!name.empty()) {
|
||||
settings.default_set_dir = wxPathOnly(name);
|
||||
Writer writer(new_shared1<wxFileOutputStream>(name), file_version_symbol);
|
||||
Writer writer(shared(new wxFileOutputStream(name)), file_version_symbol);
|
||||
writer.handle(control->getSymbol());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,9 +203,9 @@ void DropDownChoiceListBase::generateThumbnailImages() {
|
||||
status = THUMB_OK; // no need to rebuild
|
||||
} else if (img.isReady()) {
|
||||
// request this thumbnail
|
||||
thumbnail_thread.request( new_intrusive4<ChoiceThumbnailRequest>(
|
||||
thumbnail_thread.request( intrusive(new ChoiceThumbnailRequest(
|
||||
&cve, i, status == THUMB_NOT_MADE && !img.local(), img.threadSafe()
|
||||
));
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,5 +116,5 @@ void PackageChoiceValueEditor::change(const String& c) {
|
||||
|
||||
void PackageChoiceValueEditor::initDropDown() {
|
||||
if (drop_down) return;
|
||||
drop_down = new_shared2<DropDownPackageChoiceList>(&editor(), this);
|
||||
drop_down = shared(new DropDownPackageChoiceList(&editor(), this));
|
||||
}
|
||||
|
||||
@@ -1361,7 +1361,7 @@ void TextValueEditor::findWordLists() {
|
||||
throw Error(_ERROR_1_("word list type not found", name));
|
||||
}
|
||||
// add to word_lists
|
||||
word_lists.push_back(new_intrusive3<WordListPos>(pos, end, word_list));
|
||||
word_lists.push_back(intrusive(new WordListPos(pos, end, word_list)));
|
||||
// next
|
||||
pos = str.find(_("<word-list-"), end);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user