mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 23:28:12 +00:00
HackStudio: Show the currently open file in bold (in the project list)
Also import a little default C++ project called "little" :^)
This commit is contained in:
parent
31b5047894
commit
a6b153abf1
4 changed files with 33 additions and 2 deletions
13
Base/home/anon/little/Makefile
Normal file
13
Base/home/anon/little/Makefile
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
PROGRAM = little
|
||||||
|
OBJS = main.o
|
||||||
|
|
||||||
|
all: $(PROGRAM)
|
||||||
|
|
||||||
|
$(PROGRAM): $(OBJS)
|
||||||
|
$(CXX) -o $@ $(OBJS)
|
||||||
|
|
||||||
|
%.o: %.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm $(OBJS) $(PROGRAM)
|
7
Base/home/anon/little/main.cpp
Normal file
7
Base/home/anon/little/main.cpp
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int, char**)
|
||||||
|
{
|
||||||
|
printf("Hello friends!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -16,6 +16,12 @@ public:
|
||||||
if (role == Role::Display) {
|
if (role == Role::Display) {
|
||||||
return m_project.m_files.at(row);
|
return m_project.m_files.at(row);
|
||||||
}
|
}
|
||||||
|
if (role == Role::Font) {
|
||||||
|
extern String g_currently_open_file;
|
||||||
|
if (m_project.m_files.at(row) == g_currently_open_file)
|
||||||
|
return Font::default_bold_font();
|
||||||
|
return {};
|
||||||
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
virtual void update() override {}
|
virtual void update() override {}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
String g_currently_open_file;
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
GApplication app(argc, argv);
|
GApplication app(argc, argv);
|
||||||
|
@ -34,11 +36,11 @@ int main(int argc, char** argv)
|
||||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||||
widget->layout()->set_spacing(0);
|
widget->layout()->set_spacing(0);
|
||||||
|
|
||||||
if (chdir("/home/anon/serenity") < 0) {
|
if (chdir("/home/anon/little") < 0) {
|
||||||
perror("chdir");
|
perror("chdir");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
auto project = Project::load_from_file("serenity.files");
|
auto project = Project::load_from_file("little.files");
|
||||||
ASSERT(project);
|
ASSERT(project);
|
||||||
|
|
||||||
auto toolbar = GToolBar::construct(widget);
|
auto toolbar = GToolBar::construct(widget);
|
||||||
|
@ -61,6 +63,9 @@ int main(int argc, char** argv)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
text_editor->set_text(file->read_all());
|
text_editor->set_text(file->read_all());
|
||||||
|
g_currently_open_file = filename;
|
||||||
|
window->set_title(String::format("%s - HackStudio", g_currently_open_file.characters()));
|
||||||
|
project_list_view->update();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto terminal_wrapper = TerminalWrapper::construct(inner_splitter);
|
auto terminal_wrapper = TerminalWrapper::construct(inner_splitter);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue