mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Use make_intrusive/make_shared for smart pointer construction.
This commit is contained in:
@@ -231,7 +231,7 @@ void AutoReplaceWindow::onRemove(wxCommandEvent&) {
|
||||
list->removeSelected();
|
||||
}
|
||||
void AutoReplaceWindow::onAdd(wxCommandEvent&) {
|
||||
list->addItem(intrusive(new AutoReplace()));
|
||||
list->addItem(make_intrusive<AutoReplace>());
|
||||
}
|
||||
void AutoReplaceWindow::onDefault(wxCommandEvent&) {
|
||||
use_auto_replace->SetValue(true);
|
||||
|
||||
@@ -31,7 +31,7 @@ class FilterCtrl : public wxControl {
|
||||
template <typename T>
|
||||
intrusive_ptr<Filter<T> > getFilter() const {
|
||||
if (hasFilter()) {
|
||||
return intrusive(new QuickFilter<T>(getFilterString()));
|
||||
return make_intrusive<QuickFilter<T>>(getFilterString());
|
||||
} else {
|
||||
return intrusive_ptr<Filter<T> >();
|
||||
}
|
||||
|
||||
+22
-22
@@ -1039,39 +1039,39 @@ void GraphControl::setLayout(GraphType type, bool force) {
|
||||
switch (type) {
|
||||
case GRAPH_TYPE_BAR: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
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));
|
||||
combined->add(make_intrusive<GraphValueAxis>(0, true));
|
||||
combined->add(make_intrusive<GraphLabelAxis>(0, HORIZONTAL));
|
||||
combined->add(make_intrusive<BarGraph>(0));
|
||||
combined->add(make_intrusive<GraphStats>(0, ALIGN_TOP_RIGHT));
|
||||
graph = make_intrusive<GraphWithMargins>(combined, 23,8,7,20);
|
||||
break;
|
||||
} case GRAPH_TYPE_PIE: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
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));
|
||||
combined->add(make_intrusive<GraphWithMargins>(make_intrusive<PieGraph>(0), 0,0,120,0));
|
||||
combined->add(make_intrusive<GraphLegend>(0, ALIGN_TOP_RIGHT, false));
|
||||
graph = make_intrusive<GraphWithMargins>(combined, 20,20,20,20);
|
||||
break;
|
||||
} case GRAPH_TYPE_STACK: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
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));
|
||||
combined->add(make_intrusive<GraphValueAxis>(0, false));
|
||||
combined->add(make_intrusive<GraphLabelAxis>(0, HORIZONTAL));
|
||||
combined->add(make_intrusive<BarGraph2D>(0,1));
|
||||
combined->add(make_intrusive<GraphLegend>(1, ALIGN_TOP_RIGHT, true));
|
||||
graph = make_intrusive<GraphWithMargins>(combined, 23,8,7,20);
|
||||
break;
|
||||
} case GRAPH_TYPE_SCATTER: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
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));
|
||||
combined->add(make_intrusive<GraphLabelAxis>(0, HORIZONTAL, false, DRAW_LINES_MID));
|
||||
combined->add(make_intrusive<GraphLabelAxis>(1, VERTICAL, false, DRAW_LINES_MID));
|
||||
combined->add(make_intrusive<ScatterGraph>(0,1));
|
||||
graph = make_intrusive<GraphWithMargins>(combined, 80,8,7,20);
|
||||
break;
|
||||
} case GRAPH_TYPE_SCATTER_PIE: {
|
||||
intrusive_ptr<GraphContainer> combined(new GraphContainer());
|
||||
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));
|
||||
combined->add(make_intrusive<GraphLabelAxis>(0, HORIZONTAL, false, DRAW_LINES_MID));
|
||||
combined->add(make_intrusive<GraphLabelAxis>(1, VERTICAL, false, DRAW_LINES_MID));
|
||||
combined->add(make_intrusive<ScatterPieGraph>(0,1,2));
|
||||
graph = make_intrusive<GraphWithMargins>(combined, 80,8,7,20);
|
||||
break;
|
||||
} default:
|
||||
graph = GraphP();
|
||||
@@ -1085,7 +1085,7 @@ GraphType GraphControl::getLayout() const {
|
||||
}
|
||||
|
||||
void GraphControl::setData(const GraphDataPre& data) {
|
||||
setData(intrusive(new GraphData(data)));
|
||||
setData(make_intrusive<GraphData>(data));
|
||||
}
|
||||
void GraphControl::setData(const GraphDataP& data) {
|
||||
if (graph) {
|
||||
|
||||
@@ -101,7 +101,7 @@ int ImageCardList::OnGetItemImage(long pos) const {
|
||||
return it->second;
|
||||
} else {
|
||||
// request a thumbnail
|
||||
thumbnail_thread.request(intrusive(new CardThumbnailRequest(const_cast<ImageCardList*>(this), val.filename)));
|
||||
thumbnail_thread.request(make_intrusive<CardThumbnailRequest>(const_cast<ImageCardList*>(this), val.filename));
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
@@ -64,7 +64,7 @@ void TextCtrl::updateSize() {
|
||||
}
|
||||
|
||||
void TextCtrl::setValue(String* value, bool untagged) {
|
||||
setValue(intrusive(new FakeTextValue(getFieldP(), value, true, untagged)));
|
||||
setValue(make_intrusive<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(intrusive(new Set(set->stylesheet))); // dummy set
|
||||
options->setSet(make_intrusive<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);
|
||||
|
||||
@@ -92,7 +92,7 @@ void NewSetWindow::done() {
|
||||
try {
|
||||
if (!stylesheet_list->hasSelection()) return;
|
||||
StyleSheetP stylesheet = stylesheet_list->getSelection<StyleSheet>();
|
||||
set = intrusive(new Set(stylesheet));
|
||||
set = make_intrusive<Set>(stylesheet);
|
||||
set->validate();
|
||||
EndModal(wxID_OK);
|
||||
} catch (const Error& e) {
|
||||
|
||||
@@ -228,7 +228,7 @@ void PackageUpdateList::initItems() {
|
||||
ti.setIcon(load_resource_image(_("installer_package")));
|
||||
if (!p->description->icon_url.empty()) {
|
||||
// download icon
|
||||
thumbnail_thread.request(intrusive(new PackageIconRequest(this,&ti)));
|
||||
thumbnail_thread.request(make_intrusive<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, intrusive(new DownloadableInstaller(installer)));
|
||||
merge(installable_packages, make_intrusive<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 = intrusive(new Installer());
|
||||
ip->installer->installer = make_intrusive<Installer>();
|
||||
ip->installer->installer->open(ip->installer->installer_file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ PrintJobP make_print_job(Window* parent, const SetP& set, const ExportCardSelect
|
||||
return PrintJobP(); // cancel
|
||||
} else {
|
||||
// make print job
|
||||
PrintJobP job = intrusive(new PrintJob(set));
|
||||
PrintJobP job = make_intrusive<PrintJob>(set);
|
||||
job->layout_type = settings.print_layout = space->GetValue() ? LAYOUT_EQUAL_SPACE : LAYOUT_NO_SPACE;
|
||||
job->cards = wnd.getSelection();
|
||||
return job;
|
||||
|
||||
@@ -77,7 +77,7 @@ class MessageCtrl : public wxScrolledWindow {
|
||||
Refresh(false);
|
||||
}
|
||||
void add_message(MessageType type, String const& text, bool joined_to_previous = false) {
|
||||
add_message(intrusive(new ConsoleMessage(type,text,joined_to_previous)));
|
||||
add_message(make_intrusive<ConsoleMessage>(type,text,joined_to_previous));
|
||||
}
|
||||
|
||||
bool have_selection() const {
|
||||
@@ -499,7 +499,7 @@ void ConsolePanel::exec(String const& command) {
|
||||
ScriptValueP result = ctx.eval(*script,false);
|
||||
get_pending_errors();
|
||||
// show result
|
||||
ConsoleMessageP message = intrusive(new ConsoleMessage(MESSAGE_OUTPUT));
|
||||
ConsoleMessageP message = make_intrusive<ConsoleMessage>(MESSAGE_OUTPUT);
|
||||
message->joined_to_previous = true;
|
||||
message->value = result;
|
||||
// type of result
|
||||
|
||||
@@ -344,9 +344,9 @@ void KeywordsPanel::onKeywordSelect(KeywordSelectEvent& ev) {
|
||||
if (ev.keyword) {
|
||||
Keyword& kw = *ev.keyword;
|
||||
sp->Show(fixed, 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)));
|
||||
keyword ->setValue(make_intrusive<KeywordTextValue>(keyword->getFieldP(), &kw, &kw.keyword, !kw.fixed, true));
|
||||
match ->setValue(make_intrusive<KeywordTextValue>(match->getFieldP(), &kw, &kw.match, !kw.fixed));
|
||||
rules ->setValue(make_intrusive<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);
|
||||
|
||||
@@ -326,14 +326,14 @@ void CustomPackDialog::updateTotals() {
|
||||
}
|
||||
|
||||
void CustomPackDialog::storePack() {
|
||||
edited_pack = intrusive(new PackType());
|
||||
edited_pack = make_intrusive<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(intrusive(new PackItem(pick.pack->name, copies)));
|
||||
edited_pack->items.push_back(make_intrusive<PackItem>(pick.pack->name, copies));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -632,10 +632,10 @@ void RandomPackPanel::onCardSelect(CardSelectEvent& ev) {
|
||||
|
||||
void RandomPackPanel::selectionChoices(ExportCardSelectionChoices& out) {
|
||||
if (!isInitialized()) return;
|
||||
out.push_back(intrusive(new ExportCardSelectionChoice(
|
||||
out.push_back(make_intrusive<ExportCardSelectionChoice>(
|
||||
_BUTTON_("export generated packs"),
|
||||
card_list->getCardsPtr()
|
||||
)));
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -472,7 +472,7 @@ void StatsPanel::showCategory(const GraphType* prefer_layout) {
|
||||
// create axes
|
||||
GraphDataPre d;
|
||||
FOR_EACH(dim, dims) {
|
||||
d.axes.push_back(intrusive(new GraphAxis(
|
||||
d.axes.push_back(make_intrusive<GraphAxis>(
|
||||
dim->name,
|
||||
dim->colors.empty() ? AUTO_COLOR_EVEN : AUTO_COLOR_NO,
|
||||
dim->numeric,
|
||||
@@ -480,7 +480,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) {
|
||||
|
||||
@@ -309,7 +309,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(intrusive(new Card(*set->game)));
|
||||
if (set->cards.empty()) set->cards.push_back(make_intrusive<Card>(*set->game));
|
||||
// all panels view the same set
|
||||
FOR_EACH(p, panels) {
|
||||
p->setSet(set);
|
||||
@@ -383,11 +383,11 @@ void SetWindow::onCardActivate(CardSelectEvent& ev) {
|
||||
}
|
||||
|
||||
void SetWindow::selectionChoices(ExportCardSelectionChoices& out) {
|
||||
out.push_back(intrusive(new ExportCardSelectionChoice(*set))); // entire set
|
||||
out.push_back(make_intrusive<ExportCardSelectionChoice>(*set)); // entire set
|
||||
FOR_EACH(p, panels) {
|
||||
p->selectionChoices(out);
|
||||
}
|
||||
out.push_back(intrusive(new ExportCardSelectionChoice())); // custom
|
||||
out.push_back(make_intrusive<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 = intrusive(new SymbolShape);
|
||||
shape = make_intrusive<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(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)));
|
||||
shape->points.push_back(make_intrusive<ControlPoint>(c.x + r.x, c.y, 0, kr * r.y, 0, -kr * r.y, LOCK_SIZE));
|
||||
shape->points.push_back(make_intrusive<ControlPoint>(c.x, c.y - r.y, kr * r.x, 0, -kr * r.x, 0, LOCK_SIZE));
|
||||
shape->points.push_back(make_intrusive<ControlPoint>(c.x - r.x, c.y, 0, -kr * r.y, 0, kr * r.y, LOCK_SIZE));
|
||||
shape->points.push_back(make_intrusive<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(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)));
|
||||
shape->points.push_back(make_intrusive<ControlPoint>(c.x - r.x, c.y - r.y));
|
||||
shape->points.push_back(make_intrusive<ControlPoint>(c.x + r.x, c.y - r.y));
|
||||
shape->points.push_back(make_intrusive<ControlPoint>(c.x + r.x, c.y + r.y));
|
||||
shape->points.push_back(make_intrusive<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(intrusive(new ControlPoint(
|
||||
shape->points.push_back(make_intrusive<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(intrusive(new ControlPoint(
|
||||
shape->points.push_back(make_intrusive<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(intrusive(new ControlPoint(
|
||||
shape->points.push_back(make_intrusive<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(intrusive(new SymbolSelectEditor(this, false)));
|
||||
switchEditor(make_intrusive<SymbolSelectEditor>(this, false));
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void SymbolControl::onModeChange(wxCommandEvent& ev) {
|
||||
switch (ev.GetId()) {
|
||||
case ID_MODE_SELECT:
|
||||
switchEditor(intrusive(new SymbolSelectEditor(this, false)));
|
||||
switchEditor(make_intrusive<SymbolSelectEditor>(this, false));
|
||||
break;
|
||||
case ID_MODE_ROTATE:
|
||||
switchEditor(intrusive(new SymbolSelectEditor(this, true)));
|
||||
switchEditor(make_intrusive<SymbolSelectEditor>(this, true));
|
||||
break;
|
||||
case ID_MODE_POINTS:
|
||||
if (selected_parts.size() == 1) {
|
||||
selected_shape = selected_parts.getAShape();
|
||||
if (selected_shape) {
|
||||
switchEditor(intrusive(new SymbolPointEditor(this, selected_shape)));
|
||||
switchEditor(make_intrusive<SymbolPointEditor>(this, selected_shape));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -64,10 +64,10 @@ void SymbolControl::onModeChange(wxCommandEvent& ev) {
|
||||
selected_parts.clear();
|
||||
signalSelectionChange();
|
||||
}
|
||||
switchEditor(intrusive(new SymbolBasicShapeEditor(this)));
|
||||
switchEditor(make_intrusive<SymbolBasicShapeEditor>(this));
|
||||
break;
|
||||
case ID_MODE_SYMMETRY:
|
||||
switchEditor(intrusive(new SymbolSymmetryEditor(this, selected_parts.getASymmetry())));
|
||||
switchEditor(make_intrusive<SymbolSymmetryEditor>(this, selected_parts.getASymmetry()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ void SymbolControl::onUpdateSelection() {
|
||||
}
|
||||
// begin editing another part
|
||||
selected_shape = shape;
|
||||
editor = intrusive(new SymbolPointEditor(this, selected_shape));
|
||||
editor = make_intrusive<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(intrusive(new SymbolSelectEditor(this, false)));
|
||||
switchEditor(make_intrusive<SymbolSelectEditor>(this, false));
|
||||
signalSelectionChange();
|
||||
}
|
||||
|
||||
void SymbolControl::activatePart(const SymbolPartP& part) {
|
||||
if (part->isSymbolShape()) {
|
||||
selected_parts.select(part);
|
||||
switchEditor(intrusive(new SymbolPointEditor(this, static_pointer_cast<SymbolShape>(part))));
|
||||
switchEditor(make_intrusive<SymbolPointEditor>(this, static_pointer_cast<SymbolShape>(part)));
|
||||
} else if (part->isSymbolSymmetry()) {
|
||||
selected_parts.select(part);
|
||||
switchEditor(intrusive(new SymbolSymmetryEditor(this, static_pointer_cast<SymbolSymmetry>(part))));
|
||||
switchEditor(make_intrusive<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(), intrusive(new SymbolGroup())));
|
||||
addAction(new GroupSymbolPartsAction(*getSymbol(), control.selected_parts.get(), make_intrusive<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 = intrusive(new SymbolSymmetry());
|
||||
symmetry = make_intrusive<SymbolSymmetry>();
|
||||
symmetry->kind = SYMMETRY_ROTATION;
|
||||
symmetry->copies = 2;
|
||||
symmetry->center = Vector2D(0.5,0.5);
|
||||
|
||||
@@ -36,7 +36,7 @@ SymbolWindow::SymbolWindow(Window* parent, const String& filename)
|
||||
: performer(nullptr)
|
||||
{
|
||||
// open file
|
||||
Reader reader(shared(new wxFileInputStream(filename)), nullptr, filename);
|
||||
Reader reader(make_shared<wxFileInputStream>(filename), nullptr, filename);
|
||||
SymbolP symbol;
|
||||
reader.handle_greedy(symbol);
|
||||
init(parent, symbol);
|
||||
@@ -217,7 +217,7 @@ void SymbolWindow::onFileOpen(wxCommandEvent& ev) {
|
||||
String ext = n.GetExt();
|
||||
SymbolP symbol;
|
||||
if (ext.Lower() == _("mse-symbol")) {
|
||||
Reader reader(shared(new wxFileInputStream(name)), nullptr, name);
|
||||
Reader reader(make_shared<wxFileInputStream>(name), nullptr, name);
|
||||
reader.handle_greedy(symbol);
|
||||
} else {
|
||||
wxBusyCursor busy;
|
||||
@@ -240,7 +240,7 @@ void SymbolWindow::onFileSaveAs(wxCommandEvent& ev) {
|
||||
String name = wxFileSelector(_("Save symbol"),settings.default_set_dir,_(""),_(""),_("Symbol files (*.mse-symbol)|*.mse-symbol"),wxFD_SAVE, this);
|
||||
if (!name.empty()) {
|
||||
settings.default_set_dir = wxPathOnly(name);
|
||||
Writer writer(shared(new wxFileOutputStream(name)), file_version_symbol);
|
||||
Writer writer(make_shared<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( intrusive(new ChoiceThumbnailRequest(
|
||||
thumbnail_thread.request(make_intrusive<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 = shared(new DropDownPackageChoiceList(&editor(), this));
|
||||
drop_down = make_shared<DropDownPackageChoiceList>(&editor(), this);
|
||||
}
|
||||
|
||||
@@ -1367,7 +1367,7 @@ void TextValueEditor::findWordLists() {
|
||||
throw Error(_ERROR_1_("word list type not found", name));
|
||||
}
|
||||
// add to word_lists
|
||||
word_lists.push_back(intrusive(new WordListPos(pos, end, word_list)));
|
||||
word_lists.push_back(make_intrusive<WordListPos>(pos, end, word_list));
|
||||
// next
|
||||
pos = str.find(_("<word-list-"), end);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user