Skip to content

Commit

Permalink
[ADDED] include / exclude file
Browse files Browse the repository at this point in the history
[FIXED] refactoring project structure
  • Loading branch information
arakov committed Mar 23, 2024
1 parent 315c7b8 commit adea6d3
Show file tree
Hide file tree
Showing 33 changed files with 306 additions and 198 deletions.
26 changes: 0 additions & 26 deletions .circleci/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

- name: Prepare Artifact
shell: cmd
run: build\build_package_${{matrix.platform}}.bat
run: build\create_package_${{matrix.platform}}.bat

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions build/rebuild_lib60_x64.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
REM NOTE : the script MUST be called from the root folder

bin\sg64-cli dat\sg\syntax60.txt
@echo off
if %ERRORLEVEL% EQU -1 GOTO Asm2BinError
Expand Down
2 changes: 2 additions & 0 deletions build/rebuild_lib60_x86.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
REM NOTE : the script MUST be called from the root folder

.\bin\sg-cli dat\sg\syntax60.txt
@echo off
if %ERRORLEVEL% EQU -1 GOTO Asm2BinError
Expand Down
6 changes: 3 additions & 3 deletions doc/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ In development:

=== Iteration 21 ===
--------------------------------------
dev: #637, windows executable - support manifest, net, #621, #610, #612
dev: #637, windows executable - support manifest, net, #610, #612
opt:pi under 7 sec, #602, #611
maint:#620,#622
ide:vm debugger
Expand All @@ -17,10 +17,10 @@ In development:
--------------------------------------
- #617
--------------------------------------
- #617 : include / exclude

- work with elt in ide

- #621

=== Iteration 22 ===
--------------------------------------
dev: async programming (instant messagange sample (chat) ), #608
Expand Down
2 changes: 1 addition & 1 deletion elenasrc3/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// E L E N A P r o j e c t: ELENA Common Library
//
// This file contains Config File class implementation
// (C)2021-2022, by Aleksey Rakov
// (C)2021-2024, by Aleksey Rakov
//---------------------------------------------------------------------------

#include "config.h"
Expand Down
5 changes: 5 additions & 0 deletions elenasrc3/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ namespace elena_lang
xmlNode.setContent(s);
}

void remove()
{
xmlNode.remove();
}

bool isNotFound()
{
return xmlNode.isNotFound();
Expand Down
3 changes: 3 additions & 0 deletions elenasrc3/common/lists.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ namespace elena_lang
Item* tmp = nullptr;
Item* previous = nullptr;

if (!_top)
return;

if (item == _top->item)
tmp = _top;
else {
Expand Down
11 changes: 10 additions & 1 deletion elenasrc3/common/xmltree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// E L E N A P r o j e c t: ELENA Common Library
//
// This file contains XML Reader / Writer File class implementation
// (C)2021, by Aleksey Rakov
// (C)2021-2024, by Aleksey Rakov
//---------------------------------------------------------------------------

#include "xmltree.h"
Expand Down Expand Up @@ -490,3 +490,12 @@ void XmlTree :: writeContent(size_t position, ustr_t value)
_content.cut(start, end - start);
_content.insert(value.str(), start);
}

void XmlTree :: removeNode(size_t position)
{
NodeTag tag;
loadTag(getContent(), position, tag, nullptr);
size_t end = parse(_content.str(), position, _content.length(), nullptr);

_content.cut(position, end - position);
}
14 changes: 13 additions & 1 deletion elenasrc3/common/xmltree.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// E L E N A P r o j e c t: ELENA Common Library
//
// This file contains XML Tree class header
// (C)2021, by Aleksey Rakov
// (C)2021-2024, by Aleksey Rakov
//---------------------------------------------------------------------------

#ifndef XMLTREE_H
Expand Down Expand Up @@ -57,6 +57,11 @@ namespace elena_lang
return _parent->insert(position, tag);
}

virtual void removeNode(size_t position)
{
_parent->removeNode(position);
}

public:
static XmlNode Default()
{
Expand Down Expand Up @@ -85,6 +90,11 @@ namespace elena_lang
writeContent(_position, content);
}

void remove()
{
_parent->removeNode(_position);
}

XmlNode();
XmlNode(XmlNode* parent, size_t position);
};
Expand Down Expand Up @@ -122,6 +132,8 @@ namespace elena_lang

XmlNode insertNode(ustr_t xpath);

void removeNode(size_t position);

void loadXml(ustr_t content);

bool load(path_t path, FileEncoding encoding);
Expand Down
10 changes: 5 additions & 5 deletions elenasrc3/gui/controller.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// E L E N A P r o j e c t: ELENA IDE
// GUI Controller implementation File
// (C)2021-2023, by Aleksey Rakov
// (C)2021-2024, by Aleksey Rakov
//---------------------------------------------------------------------------

#include "controller.h"
Expand All @@ -11,22 +11,22 @@ using namespace elena_lang;

// --- TextViewController ---

void TextViewController :: newDocument(TextViewModelBase* model, ustr_t name)
void TextViewController :: newDocument(TextViewModelBase* model, ustr_t name, bool included)
{
Text* text = new Text(_settings.eolMode);
text->create();

model->addDocumentView(name, text, nullptr);
model->addDocumentView(name, text, nullptr, included);
}

bool TextViewController :: openDocument(TextViewModelBase* model, ustr_t name, path_t path,
FileEncoding encoding)
FileEncoding encoding, bool included)
{
Text* text = new Text(_settings.eolMode);
if (!text->load(path, encoding, false))
return false;

model->addDocumentView(name, text, path);
model->addDocumentView(name, text, path, included);

return true;
}
Expand Down
7 changes: 4 additions & 3 deletions elenasrc3/gui/controller.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------
// E L E N A P r o j e c t: ELENA IDE
// GUI Controller header File
// (C)2021-2023, by Aleksey Rakov
// (C)2021-2024, by Aleksey Rakov
//---------------------------------------------------------------------------

#ifndef CONTOLLER_H
Expand Down Expand Up @@ -103,13 +103,13 @@ namespace elena_lang
}

bool openDocument(TextViewModelBase* model, ustr_t name, path_t path,
FileEncoding encoding) override;
FileEncoding encoding, bool included) override;
bool selectDocument(TextViewModelBase* model, int index) override;
void selectNextDocument(TextViewModelBase* model);
void selectPreviousDocument(TextViewModelBase* model);
void closeDocument(TextViewModelBase* model, int index, int& status) override;

void newDocument(TextViewModelBase* model, ustr_t name) override;
void newDocument(TextViewModelBase* model, ustr_t name, bool included) override;

bool insertNewLine(TextViewModelBase* model) override;
bool insertChar(TextViewModelBase* model, text_c ch) override;
Expand Down Expand Up @@ -158,6 +158,7 @@ namespace elena_lang
TextViewController(TextViewSettings& settings)
{
_settings = settings;
_notifier = nullptr;
}
};

Expand Down
25 changes: 12 additions & 13 deletions elenasrc3/gui/document.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------
// E L E N A P r o j e c t: ELENA IDE
// DocumentView class header
// (C)2021-2023, by Aleksey Rakov
// (C)2021-2024, by Aleksey Rakov
//---------------------------------------------------------------------------

#ifndef DOCUMENT_H
Expand Down Expand Up @@ -185,29 +185,19 @@ namespace elena_lang
bool readOnly;
bool modifiedMode;
bool unnamed;
bool included;
bool overwriteMode;

int rowDifference;

bool oldModified;
bool oldSelected;
//bool oldOvewrite;

//bool isModeChanged()
//{
// bool changed = (modifiedMode != oldModified) || (overwriteMode != oldOvewrite);

// oldModified = modifiedMode;
// oldOvewrite = overwriteMode;

// return changed;
//}

void reset()
{
modifiedMode = false;
readOnly = false;
unnamed = false;
unnamed = included = false;
overwriteMode = false;
oldSelected = oldModified = false;

Expand Down Expand Up @@ -299,6 +289,7 @@ namespace elena_lang
bool isReadOnly() { return status.readOnly; }
bool isUnnamed() { return status.unnamed; }
bool isModified() { return status.modifiedMode; }
bool isIncluded() { return status.included; }

void markAsUnnamed()
{
Expand All @@ -308,6 +299,14 @@ namespace elena_lang
{
status.modifiedMode = true;
}
void markAsInclued()
{
status.included = true;
}
void markAsExcluded()
{
status.included = false;
}

Point getSize() const { return _size; }

Expand Down
8 changes: 4 additions & 4 deletions elenasrc3/gui/guieditor.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------
// E L E N A P r o j e c t: ELENA IDE
// GUI common editor header File
// (C)2021-2023, by Aleksey Rakov
// (C)2021-2024, by Aleksey Rakov
//---------------------------------------------------------------------------

#ifndef GUIEDITOR_H
Expand Down Expand Up @@ -93,7 +93,7 @@ namespace elena_lang

virtual void attachListener(TextViewListener* listener) = 0;

virtual void addDocumentView(ustr_t name, Text* text, path_t path) = 0;
virtual void addDocumentView(ustr_t name, Text* text, path_t path, bool included) = 0;
virtual void renameDocumentView(ustr_t oldName, ustr_t newName, path_t path) = 0;

virtual bool selectDocumentView(int index) = 0;
Expand Down Expand Up @@ -135,9 +135,9 @@ namespace elena_lang
class TextViewControllerBase
{
public:
virtual void newDocument(TextViewModelBase* model, ustr_t name) = 0;
virtual void newDocument(TextViewModelBase* model, ustr_t name, bool included) = 0;
virtual bool openDocument(TextViewModelBase* model, ustr_t name, path_t path,
FileEncoding encoding) = 0;
FileEncoding encoding, bool included) = 0;

virtual bool selectDocument(TextViewModelBase* model, int index) = 0;

Expand Down
6 changes: 4 additions & 2 deletions elenasrc3/gui/view.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------
// E L E N A P r o j e c t: ELENA IDE
// IDE View class body File
// (C)2021-2022, by Aleksey Rakov
// (C)2021-2024, by Aleksey Rakov
//---------------------------------------------------------------------------

#include "view.h"
Expand Down Expand Up @@ -129,12 +129,14 @@ void TextViewModel :: onDocumentClose(int index)
}
}

void TextViewModel :: addDocumentView(ustr_t name, Text* text, path_t path)
void TextViewModel :: addDocumentView(ustr_t name, Text* text, path_t path, bool included)
{
empty = false;

auto docView = new DocumentView(text, SourceFormatter::getInstance());
docView->setSize(_size);
if (included)
docView->markAsInclued();

_documents.add(new DocumentViewScope(name, path, docView));
if (emptystr(path)) {
Expand Down
2 changes: 1 addition & 1 deletion elenasrc3/gui/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace elena_lang
public:
void attachListener(TextViewListener* listener) override;

void addDocumentView(ustr_t name, Text* text, path_t path) override;
void addDocumentView(ustr_t name, Text* text, path_t path, bool included) override;
void renameDocumentView(ustr_t oldName, ustr_t newName, path_t path) override;

int getCurrentIndex();
Expand Down
2 changes: 1 addition & 1 deletion elenasrc3/gui/windows/winsdi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void VerticalBox :: setRectangle(Rectangle rec)
}
else {
int fixedHeight = 0;
for (size_t i = 1; i < count; i++) {
for (int i = 1; i < count; i++) {
fixedHeight += _list[i]->getRectangle().height();
fixedHeight += _spacer;
}
Expand Down
Loading

0 comments on commit adea6d3

Please sign in to comment.