Соединение мышью, панель линии и масштаба, ПКМ по полю - создать фигуру, поддержка высокого DPI
This commit is contained in:
parent
471418fb2a
commit
a08911920f
1 changed files with 497 additions and 215 deletions
101
FigureList.h
101
FigureList.h
|
|
@ -1,51 +1,50 @@
|
|||
// Менеджер фигур: хранит все фигуры поля, линии между ними и работает с файлом
|
||||
#ifndef FigureListH
|
||||
#define FigureListH
|
||||
|
||||
#include <vector>
|
||||
#include "BaseFigure.h"
|
||||
|
||||
// линия соединения двух фигур, у каждой линии свой цвет и толщина
|
||||
struct TFigLink
|
||||
{
|
||||
TFigure *from;
|
||||
TFigure *to;
|
||||
TColor color;
|
||||
int width;
|
||||
};
|
||||
|
||||
class TFigureManager
|
||||
{
|
||||
private:
|
||||
std::vector<TFigure*> list; // фигуры в порядке наложения (последняя - сверху)
|
||||
std::vector<TFigLink*> links; // линии соединения
|
||||
int lastNum; // последний выданный номер
|
||||
|
||||
TFigure* MakeFigure(String type, int aNum);
|
||||
void FreeAll();
|
||||
bool Joined(TFigure *a, TFigure *b);
|
||||
|
||||
public:
|
||||
TFigureManager();
|
||||
~TFigureManager();
|
||||
|
||||
TFigure* Add(String type, int ax, int ay, int aw, int ah, TColor fill, TColor line);
|
||||
void Delete(TFigure *f);
|
||||
void Clear();
|
||||
int Count();
|
||||
TFigure* FindAt(int px, int py);
|
||||
void FindInRect(TRect r, std::vector<TFigure*> &out);
|
||||
bool ToTop(std::vector<TFigure*> &figs);
|
||||
|
||||
bool Join(std::vector<TFigure*> &figs);
|
||||
bool Unjoin(std::vector<TFigure*> &figs);
|
||||
bool AnyLinks(std::vector<TFigure*> &figs);
|
||||
TFigLink* LinkAt(int px, int py);
|
||||
void DeleteLink(TFigLink *l);
|
||||
|
||||
void PaintAll(TCanvas *c);
|
||||
void Save(String fileName);
|
||||
void Load(String fileName);
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef FigureListH
|
||||
#define FigureListH
|
||||
|
||||
#include <vector>
|
||||
#include "BaseFigure.h"
|
||||
|
||||
struct TFigLink
|
||||
{
|
||||
TFigure *from;
|
||||
TFigure *to;
|
||||
TColor color;
|
||||
int width;
|
||||
};
|
||||
|
||||
class TFigureManager
|
||||
{
|
||||
private:
|
||||
std::vector<TFigure*> list;
|
||||
std::vector<TFigLink*> links;
|
||||
int lastNum;
|
||||
|
||||
TFigure* MakeFigure(String type, int aNum);
|
||||
void FreeAll();
|
||||
bool Joined(TFigure *a, TFigure *b);
|
||||
|
||||
public:
|
||||
TFigureManager();
|
||||
~TFigureManager();
|
||||
|
||||
TFigure* Add(String type, int ax, int ay, int aw, int ah, TColor fill, TColor line);
|
||||
void Delete(TFigure *f);
|
||||
void Clear();
|
||||
int Count();
|
||||
TFigure* FindAt(int px, int py);
|
||||
void FindInRect(TRect r, std::vector<TFigure*> &out);
|
||||
bool ToTop(std::vector<TFigure*> &figs);
|
||||
|
||||
TFigLink* JoinTwo(TFigure *a, TFigure *b, TColor color, int width);
|
||||
bool Join(std::vector<TFigure*> &figs, TColor color, int width);
|
||||
bool Unjoin(std::vector<TFigure*> &figs);
|
||||
bool AnyLinks(std::vector<TFigure*> &figs);
|
||||
TFigLink* LinkAt(int px, int py);
|
||||
void DeleteLink(TFigLink *l);
|
||||
|
||||
void PaintAll(TCanvas *c);
|
||||
void Save(String fileName);
|
||||
void Load(String fileName);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue