Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • demetrius/netrunner
  • despair/netrunner
  • antpy/netrunner
  • dylanbaughercontact/netrunner
  • okn3/netrunner
  • geertiebear/netrunner
  • mechacrash/netrunner
  • vaartis/netrunner
  • flat/netrunner
9 results
Show changes
Commits on Source (125)
Showing
with 355 additions and 166043 deletions
......@@ -18,10 +18,10 @@ ifeq ($(UNAME), Darwin)
CXXFLAGS = -O3 -std=c++1y -DVERSION=\"$(GIT_VERSION)\" -DPLATFORM=\"$(PLATFORM)\"
CFLAGS = -O3 -std=c11 -DVERSION=\"$(GIT_VERSION)\"
WARNINGS =
ifeq ("$(wildcard /usr/local/lib/libglfw3.dylib)","")
ifeq ("$(wildcard /usr/local/lib/libglfw3.dylib)","")
LIBS = -lglfw3 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lGLEW -lfreetype -lharfbuzz -lmbedtls -lmbedcrypto -lmbedx509
else
ifeq ("$(wildcard /usr/local/lib/libglfw.3.dylib)","")
ifeq ("$(wildcard /usr/local/lib/libglfw.3.dylib)","")
LIBS = -lglfw.3 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lGLEW -lfreetype -lharfbuzz -lmbedtls -lmbedcrypto -lmbedx509
else
LIBS = -lglfw -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lGLEW -lfreetype -lharfbuzz -lmbedtls -lmbedcrypto -lmbedx509
......@@ -48,7 +48,7 @@ RES = res/
all: $(SOURCES) netrunner
netrunner: $(OBJECTS) $(OBJDIR)/tlsf.o $(OBJDIR)/slre.o
netrunner: $(OBJECTS) $(OBJDIR)/platform/tlsf.o $(OBJDIR)/platform/slre.o
$(LINK) $(LDFLAGS) -o $@ $^ $(LIBS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
......@@ -57,22 +57,29 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARNINGS) -c -o $@ $<
@mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@
$(OBJDIR)/tlsf.o: $(SRCDIR)/tlsf.c
$(OBJDIR)/platform/tlsf.o: $(SRCDIR)/platform/tlsf.c
$(CC) $(INCPATH) $(CWARN) -DTLSF_USE_LOCKS=0 -DUSE_MMAP=1 -DUSE_SBRK=1 -c -o $@ $<
$(OBJDIR)/slre.o: $(SRCDIR)/slre.c
$(OBJDIR)/platform/slre.o: $(SRCDIR)/platform/slre.c
$(CC) $(INCPATH) $(CWARN) -c -o $@ $<
$(DEPDIR)/%d: ;
.PRECIOUS: $(DEPDIR)/%.d
test-jscpp.o: tests/testPrograms/JSParserTest.cpp
$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARINGS) -c -o $@ $<
test-js: test-jscpp.o $(OBJDIR)/parsers/scripting/javascript/JSParser.o $(OBJDIR)/tools/StringUtils.o
$(LINK) $(LDFLAGS) -o $@ test-jscpp.o $(OBJDIR)/parsers/scripting/javascript/JSParser.o $(OBJDIR)/tools/StringUtils.o $(LIBS)
test-url.o: tests/testPrograms/URLtest.cpp
$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARINGS) -c -o $@ $<
ntr-run-tests: test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o
$(LINK) $(LDFLAGS) -o $@ test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o $(LIBS)
ntr-run-tests: test-url.o $(OBJDIR)/tools/URL.o $(OBJDIR)/tools/StringUtils.o
$(LINK) $(LDFLAGS) -o $@ test-url.o $(OBJDIR)/URL.o $(OBJDIR)/tools/StringUtils.o $(LIBS)
ntr-test-cfg: test-cfg.o $(OBJDIR)/CFGFileParser.o $(OBJDIR)/slre.o $(OBJDIR)/tlsf.o $(OBJDIR)/Murmur3.o
ntr-test-cfg: test-cfg.o $(OBJDIR)/tools/CFGFileParser.o $(OBJDIR)/platform/slre.o $(OBJDIR)/platform/tlsf.o $(OBJDIR)/platform/Murmur3.o
$(LINK) $(LDFLAGS) -o $@ $^ $(LIBS)
test-cfg.o: tests/TestCFG.cpp
......
......@@ -78,12 +78,12 @@ OBJECTS = $(subst $(SRCDIR),$(OBJDIR),$(SOURCES:.cpp=.o))
all: $(SOURCES) netrunner
netrunner.res.o: netrunner.rc
netrunner.res.o: netrunner.rc netrunner.ico
@openssl des3 -d -in ../data.enc -out favicon.ico -k exdf8OWpNn -a
windres $^ -o $@
windres $< -o $@
@rm favicon.ico
netrunner: $(OBJECTS) $(OBJDIR)/tlsf.o $(OBJDIR)/slre.o netrunner.res.o
netrunner: $(OBJECTS) $(OBJDIR)/platform/tlsf.o $(OBJDIR)/platform/mmap.o $(OBJDIR)/platform/slre.o $(OBJDIR)/win32-glob.o netrunner.res.o
$(LINK) $(LDFLAGS) -o $@ $^ $(LIBS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
......@@ -92,12 +92,19 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARNINGS) -c -o $@ $<
@mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@
$(OBJDIR)/tlsf.o: $(SRCDIR)/tlsf.c
$(CC) $(INCPATH) $(CWARN) -DTLSF_USE_LOCKS=0 -DUSE_SBRK=1 -c -o $@ $<
$(OBJDIR)/platform/tlsf.o: $(SRCDIR)/platform/tlsf.c
$(CC) $(INCPATH) $(CWARN) -DTLSF_USE_LOCKS=0 -DUSE_MMAP=1 -c -o $@ $<
$(OBJDIR)/slre.o: $(SRCDIR)/slre.c
$(OBJDIR)/win32-glob.o: $(SRCDIR)/win32-glob.c
$(CC) $(INCPATH) $(CWARN) -c -o $@ $<
$(OBJDIR)/platform/slre.o: $(SRCDIR)/platform/slre.c
$(CC) $(INCPATH) $(CWARN) -c -o $@ $<
$(OBJDIR)/platform/mmap.o: $(SRCDIR)/platform/mmap.c
$(CC) $(INCPATH) $(CWARN) -c -o $@ $<
$(DEPDIR)/%d: ;
.PRECIOUS: $(DEPDIR)/%.d
......
......@@ -36,6 +36,7 @@ Looks like on Ubuntu, only zesty and newer have 2.4+ of mbedtls
`sudo pacman -Suy glew glfw freetype2 harfbuzz mbedtls`
#### Void
Note: glew maybe 1.1 here, we need 2.0
`sudo xbps-install -S glew glfw harfbuzz-devel`
#### Gentoo
......@@ -51,7 +52,7 @@ Be sure to use gmake too
## Binaries
### Linux
[2017-09-03 binary package](https://my.mixtape.moe/hgfrjt.tar.gz)
[2017-09-04 binary package](https://my.mixtape.moe/faniov.tar.gz)
GyroNinja.net is back online
......@@ -60,7 +61,7 @@ GyroNinja.net is back online
[Jenkins](https://gyroninja.net:1615/job/NetRunner/)
### OSX
[2017-09-03 binary package](https://my.mixtape.moe/ysyoee.zip)
[2017-09-03 binary package](https://my.mixtape.moe/hkacfz.zip)
### Windows
......@@ -144,11 +145,12 @@ We coordinate on [irc.rizon.net](https://www.rizon.net/chat) #/g/netrunner or [O
### Overview
- networking - downloads requested files
- html - HTML parser
- graphics - has the various interface interface
- opengl - our opengl Renderer
- text - our text rasterizer
- interface - has the various interface interface
- component - our renderer classes
- element - our DOM tree classes
- graphical
- glfw - our opengl Renderer
- font - our text rasterizer
### Class Types
- Nodes: DOM tree objects
......
This diff is collapsed.
The Netrunner framework can be used to build cross-platform applications besides a browser. The framework provides:
- renders (glfw/opengl, framebuffer, textual)
- UI widgets
- parsers (images, markup, scripting)
- networking protocols (http, https, etc)
The app class loads an interface defined in NTRML, our UI mark-up language that defines an interface.
An app is a collection of windows. Each window has a collection of UI components and a set of callbacks. Browser extends the app class to configure the app class into a web browser.
The NTRML (NeTRunner Markup Language) is a way to define a User Interface built with the NeTRunner framework. NTRML mimics HTML to provide some familiarity to those already familiar with HTML.
Colors are defined with an 8 hexadecimal digits. First 2 are Red, next 2 are Green, next 2 are Blue and the final 2 are Alpha. An Red of FF is bright red. An alpha of FF is opaque.
If a tag is marked positional below, then it supports the following attributes:
You only can use 2 of the following 3 to position and size your component:
height (optional) - height in pixels or percentage
top (optional) - top in pixels or percentage
bottom (optional) - bottom in pixels or percentage
You only can use 2 of the following 3 to position and size your component:
width (optional) - width in pixels or percentage
left (optional) - left in pixels or percentage
right (optional) - right in pixels or percentage
TAGS
body - wraps around everything to provide some default values
body.color - set default text color
body.bgcolor - set default background color
layer - we draw back to front. This gives you a way to order your controls.
img - renders an image
img.name - label for debugging
img.src - filename to load (currently only pnm/pam supported)
img is positional
tabSelector - where to place the tab selector
tabSelector.color - set text color
tabSelector.hover - set hover color
tabSelector is positional
box - renders a box shape
box.color - shape color
box.hover - hover color
box.onclick - functionality if clicked
box is positional
input - an input box control
input.color - text color
input.bgcolor - background color
input.onclick - functionality if clicked
input.fontSize - font size in pixels
input is positional
font - renders text
font.src - font to use (ttf supported)
font.family - will eventually support web-safe fonts
font.size - text size in pixels
font.color - set default text color
font.bgcolor - set default background color
font is positional
netrunner.ico

8.65 KiB | W: 0px | H: 0px

netrunner.ico

8.65 KiB | W: 0px | H: 0px

netrunner.ico
netrunner.ico
netrunner.ico
netrunner.ico
  • 2-up
  • Swipe
  • Onion skin
......@@ -454,7 +454,7 @@ DEFAULT_INDEX_FILE:[http://scout.wisc.edu/]
#LOCALE_CHARSET:FALSE
.h2 HTML5_CHARSETS
# HTML5_CHARSETS is an alternative to ASSUME_CHARSET and ASSUME_LOCAL_CHARSET.
# HTML5_CHARSETS is an alternative to ASSUME_CHARSET and ASSUME_LOCAL_CHARSET.
# Those assume by default that the character set of an HTML document is (as is
# standard in HTML4) ISO-8859-1, in the absence of locale information.
#
......@@ -3703,3 +3703,8 @@ COLOR:[6/brightred/black]
# the page and corresponding lists, and reusing the original link number.
# This can be set via command-line "-unique-urls".
#UNIQUE_URLS:FALSE
.h1 Netrunner
.h2 Javascript
CONSOLE:[FALSE]
JAVASCRIPT:[TRUE]
document = {
head: "",
documentElement: {},
getElementsByTagName: function(tag) {
return [];
},
querySelector: function(selector) {
return null;
},
querySelectorAll: function(selector) {
},
addEventListener: function(label, cb, overwrite) {
//
}
};
window.innerWidth=600
Date = {
now: function() {
//__netrunner_datenow();
}
}
XMLHttpRequest = {
// withCredentials:
}
#include "StringUtils.h"
#include <algorithm>
#include <iostream>
#include <iterator>
#include <algorithm>
/**
* get an extension from a filename
* @param fileName a filename string
* @return '' or a string with the found extension
*/
const std::string getFilenameExtension(std::string const& fileName) {
auto dotPos = fileName.find_last_of('.');
if (dotPos != std::string::npos && dotPos + 1 != std::string::npos) {
//std::cout << "StringUtils::getFilenameExtension - " << fileName.substr(dotPos + 1) << std::endl;
return fileName.substr(dotPos + 1);
}
return "";
}
/**
* get an document from a url
* @param url url string
* @return '' or a string with the found document
*/
const std::string getDocumentFromURL(const std::string &url) {
int slashes = 0;
for (unsigned int i = 0; i < url.length(); i++) {
if (url[i] == '/') {
slashes++;
if (slashes == 3) {
return url.substr(i, url.length() - i);
}
}
}
return "";
}
/**
* get host from a url
* @param url url string
* @return '' or a string with the found host
*/
const std::string getHostFromURL(const std::string &url) {
auto colonDoubleSlash = url.find("://");
if (colonDoubleSlash != std::string::npos) {
auto startPos = colonDoubleSlash + 3;
auto thirdSlash = url.find("/", startPos);
if (thirdSlash == std::string::npos) {
return url.substr(startPos);
}
return url.substr(startPos, thirdSlash - startPos);
}
return "";
}
/**
* get scheme from a url
* @param url url string
* @return '' or a string with the found protocol
*/
const std::string getSchemeFromURL(const std::string &url) {
auto colonDoubleSlash = url.find("://");
if (colonDoubleSlash != std::string::npos) {
return url.substr(0, colonDoubleSlash);
}
return "";
}
/**
* convert string to lowercase
* @param str string
* @return lowercased version of str
*/
const std::string toLowercase(const std::string &str) {
std::string returnString = "";
std::transform(str.begin(),
str.end(),
back_inserter(returnString),
tolower);
return returnString;
/*
std::string stringToLower(std::string s) {
std::transform(s.begin(), s.end(), s.begin(),
[](unsigned char c){ return std::tolower(c); });
return s;
*/
}
#include "browser.h"
#include "scheduler.h"
#include "interfaces/components/TabbedComponent.h"
#include "parsers/markup/ntrml/NTRMLParser.h"
#include "parsers/markup/html/HTMLParser.h"
#include "app.h"
#include "../tools/Scheduler.h"
#include "../interfaces/components/TabbedComponent.h"
#include "../parsers/markup/ntrml/NTRMLParser.h"
#include "../parsers/markup/html/HTMLParser.h"
#include "interfaces/components/InputComponent.h"
#include "interfaces/components/ImageComponent.h"
#include "interfaces/components/TabbedComponent.h"
#include "interfaces/components/ButtonComponent.h"
#include "../interfaces/components/DocumentComponent.h"
//#include "interfaces/components/ComponentBuilder.h"
#include "../interfaces/components/InputComponent.h"
#include "../interfaces/components/ImageComponent.h"
#include "../interfaces/components/TabbedComponent.h"
#include "../interfaces/components/ButtonComponent.h"
#include <fstream>
#ifndef _WIN32
#include <glob.h>
#else
#include "../win32-glob.h"
#endif
// why can't I const this?
std::unique_ptr<Scheduler> scheduler = std::make_unique<Scheduler>();
// Previously defined components with functionality
// 1+ image (no functionality)
// 1+ tabbed document
// 1+ back/fwd/reload/stop components
// 1+ address bar
void doOnClick(std::string type, Component *component, Window *win) {
if (type=="back") {
component->onClick=[win]() {
......@@ -66,18 +66,18 @@ void doOnClick(std::string type, Component *component, Window *win) {
return;
}
//std::cout << "Browser:zdoOnClick.navAddressBar->onClick - got " << value << std::endl;
TabbedComponent *p_tabComponent = dynamic_cast<TabbedComponent*>(win->tabComponent.get());
if (p_tabComponent) {
if (!p_tabComponent->tabs.size()) {
p_tabComponent->addTab("Loading...");
p_tabComponent->selectTab(p_tabComponent->tabs.back());
win->renderDirty = true;
win->render(); // display loading tab before IO
}
}
std::shared_ptr<DocumentComponent> docComponent = win->getActiveDocumentComponent();
if (docComponent) {
//std::cout << "Browser:zdoOnClick.navAddressBar->onClick - Found an active document component" << std::endl;
......@@ -141,7 +141,7 @@ void App::rebuildTheme() {
this->layers.clear(); // nuke any layers we have
this->createComponentTree(this->uiRootNode, rootComponent, win);
//Component::printComponentTree(rootComponent, 0);
// these probably should be fatal
if (!win->addressComponent) {
std::cout << "ERROR: no addressComponent" << std::endl;
......@@ -149,7 +149,7 @@ void App::rebuildTheme() {
if (!win->tabComponent) {
std::cout << "ERROR: no tabComponent" << std::endl;
}
// we want each window to has it's own component tree, so each address bar can have different values
size_t layerCount = 0;
for(auto layer: this->layers) {
......@@ -166,11 +166,11 @@ void App::rebuildTheme() {
layer.reset(); // deallocate our local layers
}
rootComponent.reset();
//newWindow->rootComponent = rootComponent;
//newWindow->ui->rootComponent = rootComponent;
win->renderDirty = true;
}
}
......@@ -181,14 +181,14 @@ void App::transferTheme(std::string filename) {
for(auto win: this->windows) {
glfwMakeContextCurrent(win->window);
TabbedComponent *oldTabbedComponent = nullptr;
if (win->tabComponent) {
oldTabbedComponent = dynamic_cast<TabbedComponent *>(win->tabComponent.get());
}
win->tabComponent = nullptr; // release to release
win->addressComponent = nullptr; // I think this is ok to release now
// convert uiRootNode into a component list
std::shared_ptr<Component> rootComponent = std::make_shared<Component>();
rootComponent->name = "rootComponent of browser";
......@@ -196,7 +196,7 @@ void App::transferTheme(std::string filename) {
// we build one global tree that each layer has a child node in
this->createComponentTree(this->uiRootNode, rootComponent, win);
//Component::printComponentTree(rootComponent, 0);
// these probably should be fatal
if (!win->addressComponent) {
std::cout << "ERROR: no addressComponent" << std::endl;
......@@ -204,7 +204,7 @@ void App::transferTheme(std::string filename) {
if (!win->tabComponent) {
std::cout << "ERROR: no tabComponent" << std::endl;
}
// ok now we need to transfer the tabs over
if (oldTabbedComponent) {
// should have been set in createComponentTree
......@@ -218,7 +218,7 @@ void App::transferTheme(std::string filename) {
if (oldDocComponent) {
//std::cout << "Reading DOM" << std::endl;
//printNode(oldDocComponent->domRootNode, 0);
std::shared_ptr<Tab> nTab = newTabbedComponent->addTab(tab->titleBox->text);
newTabbedComponent->selectTab(nTab);
// maybe faster if we can skip the component tree rebuild
......@@ -279,13 +279,13 @@ void App::transferTheme(std::string filename) {
} else {
std::cout << "old theme didnt have tab component" << std::endl;
}
// now we're officially done with old layer, nuked them
for(auto layer: win->ui->layers) {
layer.reset();
}
win->ui->layers.clear();
// we want each window to has it's own component tree, so each address bar can have different values
size_t layerCount = 0;
for(auto layer: this->layers) {
......@@ -302,7 +302,7 @@ void App::transferTheme(std::string filename) {
layer.reset(); // deallocate our local layers
}
rootComponent.reset();
//newWindow->rootComponent = rootComponent;
//newWindow->ui->rootComponent = rootComponent;
win->renderDirty = true;
......@@ -312,7 +312,11 @@ void App::transferTheme(std::string filename) {
void App::NextTheme() {
glob_t glob_result;
static unsigned int t = 0;
glob("*.ntrml", GLOB_TILDE, NULL, &glob_result);
#ifndef _WIN32
glob("*.ntrml", GLOB_TILDE, nullptr, &glob_result);
#else
glob("*.ntrml", GLOB_NOCHECK, nullptr, &glob_result);
#endif
t++;
if (t == glob_result.gl_pathc) t = 0;
/*
......@@ -334,26 +338,11 @@ void App::NextTheme() {
// and replacing with new version of existing theme
}
Browser::Browser() {
/*
std::string ntrml, line;
std::ifstream myfile("browser.ntrml");
if (myfile.is_open()) {
while(getline(myfile, line)) {
ntrml += line;
}
myfile.close();
} else {
std::cout << "Couldnt read browser.ntrml" << std::endl;
}
NTRMLParser uiParser;
//std::cout << "Browser read [" << ntrml << "]" << std::endl;
*/
//this->uiRootNode = uiParser.parse(ntrml);
this->uiRootNode = this->loadTheme("browser.ntrml");
//printNode(this->uiRootNode, 0);
}
// Previously defined components with functionality
// 1+ image (no functionality)
// 1+ tabbed document
// 1+ back/fwd/reload/stop components
// 1+ address bar
void App::createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<Component> &parentComponent, std::shared_ptr<Window> win) {
// FIXME: remove these 2 vars
int winWidth = win->windowWidth;
......@@ -370,6 +359,8 @@ void App::createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<
tag = tagNode->tag;
}
} else if (node->nodeType == NodeType::TEXT) {
// just ignore text blocks
return;
tagNode = dynamic_cast<TagNode*>(node->parent.get());
if (tagNode) {
tag = tagNode->tag;
......@@ -400,7 +391,7 @@ void App::createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<
ss << std::hex << tagNode->properties["bgcolor"];
ss >> win->clearColor;
//std::cout << "set clear color " << std::hex << win->clearColor << std::dec << std::endl;
float r = (static_cast<float>((win->clearColor >> 24) & 0xFF)) / 255;
float g = (static_cast<float>((win->clearColor >> 16) & 0xFF)) / 255;
float b = (static_cast<float>((win->clearColor >> 8) & 0xFF)) / 255;
......@@ -431,12 +422,20 @@ void App::createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<
//std::cout << "Added img component to ui" << std::endl;
} else if (tag == "font") {
// TextComponent(const std::string &rawText, const int rawX, const int rawY, const unsigned int size, const bool bolded, const unsigned int hexColor, const int passedWindowWidth, const int passedWindowHeight);
std::shared_ptr<TextComponent> text = std::make_unique<TextComponent>("NeTRunner", 0, 0, 12, false, 0x000000FF, winWidth, winHeight);
std::string label = "NeTRunner";
if (node->children.size()) {
TextNode *textNode = dynamic_cast<TextNode*>(node->children.front().get());
if (textNode) {
label = textNode->text;
}
}
std::shared_ptr<TextComponent> text = std::make_unique<TextComponent>(label, 0, 0, 12, false, 0x000000FF, winWidth, winHeight);
text->boundToPage = false; // have to set this before setUpUI
text->win = win;
// this may not work for the text shader...
// this may not work for the text shader... yea doesn't seem to
text->setUpUI(tagNode->properties, win.get());
text->isPickable = false;
//text->resize(win->windowWidth, win->windowHeight); // force a re-raster
// set up interactivity
if (tagNode->properties.find("onClick") != tagNode->properties.end()) {
text->isPickable = true;
......@@ -452,7 +451,7 @@ void App::createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<
ss >> color;
//std::cout << "read color " << tagNode->properties["color"] << " as " << std::hex << color << std::dec << std::endl;
}
// winHeight minus because box coordinates? yes
//std::cout << "placing box at " << cX << "," << cY << " " << cW << "x" << cH << " color: " << std::hex << color << std::dec << std::endl;
//std::shared_ptr<BoxComponent> box = std::make_unique<BoxComponent>(cX, winHeight - cH - cY, cW, cH, color, winWidth, winHeight);
......@@ -524,18 +523,18 @@ void App::createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<
navAddressBar->onEnter=[win](std::string value) {
std::cout << "navAddressBar::onEnter got " << value << std::endl;
TabbedComponent *p_tabComponent = dynamic_cast<TabbedComponent*>(win->tabComponent.get());
if (p_tabComponent) {
if (!p_tabComponent->tabs.size()) {
p_tabComponent->addTab("Loading...");
p_tabComponent->selectTab(p_tabComponent->tabs.back());
win->renderDirty = true;
win->render(); // display loading tab before IO
}
}
std::shared_ptr<DocumentComponent> docComponent = win->getActiveDocumentComponent();
if (docComponent) {
std::cout << "Found an active document component" << std::endl;
......@@ -545,7 +544,7 @@ void App::createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<
std::cout << "No active document component" << std::endl;
}
};
navAddressBar->win = win;
win->addressComponent = navAddressBar;
component = navAddressBar;
......@@ -585,6 +584,32 @@ void App::createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<
component.reset();
}
void App::addJSDebuggerWindow() {
windowCounter++;
std::shared_ptr<Window> newWindow = std::make_shared<Window>();
newWindow->id = windowCounter;
newWindow->windowWidth = 1024;
newWindow->windowHeight = 640;
newWindow->init(); // load our UI into it
std::shared_ptr<Component> p_rootComponent = std::make_shared<Component>();
p_rootComponent->name = "rootComponent of jsconsole";
std::shared_ptr<TextComponent> outputComp = std::make_shared<TextComponent>("NeTRunner JavaScript console", 0, 0, 12, false, 0x000000FF, newWindow->windowWidth, newWindow->windowHeight);
outputComp->win = newWindow;
newWindow->ui->layers.push_back(outputComp);
outputComp.reset();
/*
std::shared_ptr<InputComponent> inputComp = std::make_shared<InputComponent>(0, 0, 1024, 12, newWindow->windowWidth, newWindow->windowHeight);
inputComp->win = newWindow;
newWindow->ui->layers.push_back(inputComp);
inputComp.reset();
*/
this->windows.push_back(newWindow);
newWindow.reset();
}
void App::addWindow() {
windowCounter++;
std::shared_ptr<Window> newWindow = std::make_shared<Window>();
......@@ -592,15 +617,16 @@ void App::addWindow() {
newWindow->windowWidth = 1024;
newWindow->windowHeight = 640;
newWindow->init(); // load our UI into it
newWindow->openglWindow->app = this;
// convert uiRootNode into a component list
std::shared_ptr<Component> p_rootComponent = std::make_shared<Component>();
p_rootComponent->name = "rootComponent of browser";
// we build one global tree that each layer has a child node in
this->layers.clear(); // nuke any layers we have
this->createComponentTree(this->uiRootNode, p_rootComponent, newWindow);
//Component::printComponentTree(p_rootComponent, 0);
// these probably should be fatal
if (!newWindow->addressComponent) {
std::cout << "ERROR: no addressComponent" << std::endl;
......@@ -608,7 +634,7 @@ void App::addWindow() {
if (!newWindow->tabComponent) {
std::cout << "ERROR: no tabComponent" << std::endl;
}
// we want each window to has it's own component tree, so each address bar can have different values
size_t layerCount = 0;
for(auto layer: this->layers) {
......@@ -624,29 +650,22 @@ void App::addWindow() {
layerCount++;
layer.reset(); // deallocate our local layers
}
this->layers.clear(); // nuke any layers we have
p_rootComponent.reset();
//newWindow->rootComponent = rootComponent;
//newWindow->ui->rootComponent = rootComponent;
newWindow->renderDirty = true;
this->windows.push_back(newWindow);
newWindow.reset();
if (!activeWindow) {
//std::cout << "Browser::addWindow - setting active window" << std::endl;
activeWindow = this->windows.back().get();
}
}
std::shared_ptr<DocumentComponent> Browser::getActiveDocumentComponent() {
if (!activeWindow) {
std::cout << "Browser::getActiveDocumentComponent - No active window" << std::endl;
return nullptr;
}
return this->activeWindow->getActiveDocumentComponent();
}
// FIXME: put quit check in here and clean up windows
void App::render() {
// guessing during render this iterator can be invalidated
......@@ -688,6 +707,7 @@ void App::loop() {
// FIXME: one close shouldn't close the app
for(std::vector<std::shared_ptr<Window>>::iterator it = this->windows.begin(); it != this->windows.end(); ++it) {
if (glfwWindowShouldClose(it->get()->window)) {
// FIXME: just remove window from stack
shouldQuit = true;
break;
}
......
#ifndef APP_H
#define APP_H
#include "interfaces/graphical/renderers/glfw/Window.h"
#include "interfaces/components/Component.h"
#include "parsers/markup/Node.h"
#include "../interfaces/graphical/renderers/glfw/Window.h"
#include "../interfaces/components/Component.h"
#include "../parsers/markup/Node.h"
//#include <GL/glew.h>
//#include <GLFW/glfw3.h>
//#include <memory>
#include <vector>
#include "../platform/tlsf.h"
//#include <algorithm>
void doOnClick(std::string type, Component *component, Window *win);
......@@ -23,6 +24,7 @@ public:
void transferTheme(std::string filename);
void NextTheme();
void createComponentTree(const std::shared_ptr<Node> node, std::shared_ptr<Component> &parentComponent, std::shared_ptr<Window> win);
void addJSDebuggerWindow();
void addWindow();
void render();
void loop();
......@@ -32,6 +34,8 @@ public:
//
std::shared_ptr<Node> uiRootNode;
std::vector<std::shared_ptr<Component>> layers;
bool jsEnable = false;
// because components take a shared_ptr for win, this has to be shared too
std::vector<std::shared_ptr<Window>> windows;
......
#include "browser.h"
#include "interfaces/components/TabbedComponent.h"
#include "parsers/markup/html/HTMLParser.h"
#include "../../interfaces/components/TabbedComponent.h"
#include "../../parsers/markup/html/HTMLParser.h"
#include "interfaces/components/InputComponent.h"
#include "interfaces/components/ImageComponent.h"
#include "interfaces/components/TabbedComponent.h"
#include "interfaces/components/ButtonComponent.h"
#include "../../interfaces/components/InputComponent.h"
#include "../../interfaces/components/ImageComponent.h"
#include "../../interfaces/components/TabbedComponent.h"
#include "../../interfaces/components/ButtonComponent.h"
Browser::Browser() {
/*
......@@ -27,9 +27,11 @@ Browser::Browser() {
//printNode(this->uiRootNode, 0);
}
/*
void Browser::addWindow() {
App::addWindow();
}
*/
std::shared_ptr<DocumentComponent> Browser::getActiveDocumentComponent() {
if (!activeWindow) {
......
#ifndef BROWSER_H
#define BROWSER_H
#include "app.h"
#include "../app.h"
//#include "interfaces/graphical/renderers/glfw/Window.h"
//#include "interfaces/components/Component.h"
#include "interfaces/components/DocumentComponent.h"
#include "../../interfaces/components/DocumentComponent.h"
//#include "interfaces/components/ComponentBuilder.h"
//#include "parsers/markup/Node.h"
//#include <GL/glew.h>
......@@ -21,12 +21,15 @@ class Browser : public App {
private:
public:
Browser();
void addWindow();
std::shared_ptr<DocumentComponent> getActiveDocumentComponent();
//void addWindow();
// does not sound very browser specific, I could see other apps needing this
// but not all apps would use a doc component
std::shared_ptr<DocumentComponent> getActiveDocumentComponent();
std::shared_ptr<Component> tabComponent = nullptr;
std::shared_ptr<Component> addressComponent = nullptr;
//URL currentURL;
};
......
......@@ -3,7 +3,7 @@
#include <vector>
#include "Path.h"
#include "../Log.h"
#include "../tools/Log.h"
std::string Environment::resourceDir = "";
......@@ -16,7 +16,8 @@ void Environment::init() {
};
#ifndef _WIN32
// linux or osx
paths.push_back("/usr/share/netrunner/resources");
paths.push_back("/usr/share/netrunner/resources");
paths.push_back("/usr/local/share/netrunner/resources");
#else
paths.push_back(""); //TODO: place it somewhere for windows
#endif
......
......@@ -18,7 +18,7 @@ std::unique_ptr<std::pair<UImetricV2, UImetricV2>> getUIMetric(UImetricV2 &s1, U
}
std::unique_ptr<std::pair<UImetricV2, UImetricV2>> result=std::make_unique<std::pair<UImetricV2, UImetricV2>>();
if (s1.requested && s2.requested) {
// left/right
// left/right top/bottom
//std::cout << "left/right px " << s1.px << " & " << s2.px << std::endl;
//std::cout << "left/right % " << s1.pct << " & " << s2.pct << std::endl;
result->first = { true, s1.pct, s1.px }; // pos
......@@ -41,18 +41,18 @@ std::unique_ptr<std::pair<UImetricV2, UImetricV2>> getUIMetric(UImetricV2 &s1, U
*/
} else
if (s1.requested && size.requested) {
// left + width
// left + width top+height
result->first = { true, s1.pct, s1.px }; // pos
result->second = { true, size.pct, size.px };
} else
if (s2.requested && size.requested) {
// right - width
// right - width bottom-height
// right 25% = left 75%
// + width 50% means start at 25%
result->first = { true, (100.0 - s2.pct) - size.pct, -s2.px - size.px }; // pos
result->second = { true, size.pct, size.px };
} else {
std::cout << "component.getUIMetric - Unkown state" << std::endl;
std::cout << "component.getUIMetric - Unknown state" << std::endl;
}
return result;
}
......@@ -66,7 +66,9 @@ void Component::setUpUI(std::map<std::string, std::string> &properties, Window *
UILayoutV2 boxSetup;
boxSetup.width.px = 32;
boxSetup.height.px = 32;
//std::cout << "Component::setUpUI - type: " << typeOfComponent(this) << std::endl;
if (properties.find("width") != properties.end()) {
//std::cout << "Component::setUpUI - has width" << std::endl;
boxSetup.width.requested = true;
if (properties["width"][properties["width"].size() - 1] == '%') {
//std::cout << "Component::setUpUI - found width %" << std::endl;
......@@ -103,6 +105,7 @@ void Component::setUpUI(std::map<std::string, std::string> &properties, Window *
}
}
if (properties.find("left") != properties.end()) {
//std::cout << "Component::setUpUI - has left" << std::endl;
boxSetup.left.requested = true;
if (properties["left"][properties["left"].size() - 1] == '%') {
//std::cout << "Component::setUpUI - found left %" << std::endl;
......@@ -112,6 +115,7 @@ void Component::setUpUI(std::map<std::string, std::string> &properties, Window *
}
}
if (properties.find("right") != properties.end()) {
//std::cout << "Component::setUpUI - has right" << std::endl;
boxSetup.right.requested = true;
if (properties["right"][properties["right"].size() - 1] == '%') {
//std::cout << "Component::setUpUI - found right %" << std::endl;
......@@ -120,6 +124,14 @@ void Component::setUpUI(std::map<std::string, std::string> &properties, Window *
boxSetup.right.px = std::stoi(properties["right"]);
}
}
/*
std::cout << "boxSetup left : " << boxSetup.left.requested << " " << boxSetup.left.pct << "% @" << boxSetup.left.px << std::endl;
std::cout << "boxSetup right: " << boxSetup.right.requested << " " << boxSetup.right.pct << "% @" << boxSetup.right.px << std::endl;
std::cout << "boxSetup width: " << boxSetup.width.requested << " " << boxSetup.width.pct << "% @" << boxSetup.width.px << std::endl;
std::cout << "boxSetup top : " << boxSetup.top.requested << " " << boxSetup.top.pct << "% @" << boxSetup.top.px << std::endl;
std::cout << "boxSetup bottom: " << boxSetup.bottom.requested << " " << boxSetup.bottom.pct << "% @" << boxSetup.bottom.px << std::endl;
std::cout << "boxSetup height: " << boxSetup.height.requested << " " << boxSetup.height.pct << "% @" << boxSetup.height.px << std::endl;
*/
std::unique_ptr<std::pair<UImetricV2, UImetricV2>> xUI = getUIMetric(boxSetup.left, boxSetup.right, boxSetup.width);
std::unique_ptr<std::pair<UImetricV2, UImetricV2>> yUI = getUIMetric(boxSetup.top, boxSetup.bottom, boxSetup.height);
//int cX = 0, cY = 0;
......
......@@ -38,11 +38,11 @@ struct UImetricV2 {
class UILayoutV2 {
public:
// only height or 2 of these can be set
UImetricV2 top = { false, 0.0, 0 };
UImetricV2 top = { false, 0.0, 0 };
UImetricV2 bottom = { false, 0.0, 0 };
UImetricV2 height = { false, 0.0, 0 };
// only width or 2 of these can be set
UImetricV2 left = { false, 0.0, 0 };
UImetricV2 left = { false, 0.0, 0 };
UImetricV2 right = { false, 0.0, 0 };
UImetricV2 width = { false, 0.0, 0 };
};
......
......@@ -12,6 +12,8 @@
#include "../elements/INPUTElement.h"
#include "../elements/BUTTONElement.h"
#include "../elements/TEXTAREAElement.h"
#include "../elements/SCRIPTElement.h"
#include "../elements/LINKElement.h"
#include "InputComponent.h"
#include "ButtonComponent.h"
......@@ -36,6 +38,8 @@ const std::unordered_map<std::string, std::shared_ptr<Element>> ComponentBuilder
{"textarea", std::make_shared<TEXTAREAElement>()},
{"button", std::make_shared<BUTTONElement>()},
{"b", std::make_shared<STRONGElement>()},
{"script", std::make_shared<SCRIPTElement>()},
{"link", std::make_shared<LINKElement>()},
{"i", std::make_shared<SPANElement>()}
};
......
#include "DocumentComponent.h"
#include <cmath>
#include <iostream>
#include "../../Log.h"
#include "InputComponent.h"
#include "ButtonComponent.h"
#include "TabbedComponent.h"
#include <ctime>
#include "../graphical/renderers/glfw/Shader.h"
#include "../../WebResource.h"
#include "../../browser.h"
#include "../../tools/Log.h"
#include "../../tools/WebResource.h"
#include "../../app/browser/browser.h"
#include "../../parsers/markup/html/HTMLParser.h"
void deleteComponent(std::shared_ptr<Component> &component);
......@@ -53,26 +53,40 @@ size_t getNumberOfLines(std::string text) {
return lines;
}
#include <fstream>
DocumentComponent::DocumentComponent(const float rawX, const float rawY, const float rawWidth, const float rawHeight, const int passedWindowWidth, const int passedWindowHeight) : MultiComponent(rawX, rawY, rawWidth, rawHeight, passedWindowWidth, passedWindowHeight) {
//std::cout << "DocumentComponent::DocumentComponent" << std::endl;
windowWidth = passedWindowWidth;
windowHeight = passedWindowHeight;
//std::cout << "DocumentComponent::DocumentComponent - window size: " << windowWidth << "x" << windowHeight << std::endl;
std::shared_ptr<Component> rootComponent = std::make_shared<Component>();
this->layers.push_back(rootComponent);
x = rawX;
y = rawY;
width = rawWidth;
height = rawHeight;
if (height < 0) {
std::cout << "DocumentComponent::DocumentComponent - height was less than zero" << std::endl;
height = 0;
}
std::ifstream fin("res/ntr_bootstrap.js");
std::stringstream buffer;
buffer << fin.rdbuf();
std::string bootstrap_js = buffer.str();
if (bootstrap_js == "") {
std::cout << "DocumentComponent::DocumentComponent - ERROR: Could not load res/ntr_bootstrap.js" << std::endl;
} else {
//std::cout << "DocumentComponent::DocumentComponent - Loaded [" << bootstrap_js << "] ntr_bootstrap.js\n";
this->bootstrapScript = std::make_shared<JavaScript>();
this->bootstrapScript->parse(bootstrap_js);
}
//std::cout << "DocumentComponent::DocumentComponent - our size" << static_cast<int>(width) << "x" << static_cast<int>(height) << std::endl;
onMousemove=[this](int passedX, int passedY) {
// set hover component
......@@ -272,9 +286,20 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
}
printf("\n\n");
}
if (key == GLFW_KEY_V && action == GLFW_RELEASE) {
printf("Printing JS Variables\n\n");
//std::cout << "DocumentComponent::render - JS var state" << std::endl;
for(auto it : this->mainScript->rootScope.locals.value) {
std::cout << "[" << it.first << "=" << it.second << "]" << std::endl;
}
printf("\n\n");
}
if (key == GLFW_KEY_T && action == GLFW_RELEASE) {
browser->NextTheme();
}
if (key == GLFW_KEY_N && action == GLFW_RELEASE) {
browser->addWindow();
}
// FIXME: probably should just direct set the scroll
// we should have a function for setting scrollY position
if (key == GLFW_KEY_HOME && (action == GLFW_RELEASE || action == GLFW_REPEAT)) {
......@@ -312,19 +337,19 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
if (key == GLFW_KEY_PAGE_UP && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
std::cout << "PgUp is/was pressed. Scrolling down." << std::endl;
this->scrollY(-yOffsetScroll*0.1);
}
if (key == GLFW_KEY_PAGE_DOWN && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
std::cout << "PgDn is/was pressed. Scrolling up." << std::endl;
this->scrollY(yOffsetScroll*0.1);
}
// FIXME Scrolling with this can scroll past boundary whereas the same doesn't happen with
// scrolling wheel
if (key == GLFW_KEY_J && (action == GLFW_PRESS || action == GLFW_REPEAT)) {
std::cout << "J is/was pressed. Scrolling down." << std::endl;
this->scrollY(-yOffsetScroll*0.1);
}
// FIXME Scrolling with this can scroll past boundary whereas the same doesn't happen with
// scrolling wheel
......@@ -393,16 +418,27 @@ void DocumentComponent::setDOM(const std::shared_ptr<Node> rootNode) {
if (domRootNode) {
deleteNode(domRootNode);
}
// reset JS engine
//mainScript.clear();
mainScript = std::make_shared<JavaScript>();
if (this->bootstrapScript) {
mainScript->applyScope(this->bootstrapScript);
mainScript->append(this->bootstrapScript);
} else {
std::cout << "DocumentComponent::setDOM - no bootstrap JS loaded\n";
}
// reset scroll position
//transformMatrix[13] = 2;
//transformMatrixDirty = true;
this->scrollY(0);
// new root component
rootComponent = std::make_shared<Component>();
rootComponent->name = "rootComponent of " + name;
rootComponent->y = y;
domRootNode = rootNode;
//std::cout << "DocumentComponent::setDOM - printing nodes" << endl; printNode(domRootNode, 0);
domDirty = true;
......@@ -417,9 +453,17 @@ void DocumentComponent::render() {
const std::clock_t end = clock();
// root component here doesn't have any children...
std::cout << "built & laid out document components in: " << std::fixed << ((static_cast<double>(end - begin)) / CLOCKS_PER_SEC) << std::scientific << " seconds" << std::endl;
//Component::printComponentTree(rootComponent, 0);
domDirty = false;
/*
std::cout << "DocumentComponent::render - JS var state" << std::endl;
for(auto it : this->mainScript->rootScope.variables) {
std::cout << "[" << it.first << "=" << it.second << "]" << std::endl;
}
*/
//std::cout << "root Height: " << static_cast<int>(rootComponent->height) << " window Height: " << windowHeight << " y " << static_cast<int>(this->y) << std::endl;
//scrollHeight = std::max(0, static_cast<int>(rootComponent->height - (windowHeight + (this->y * 2))));
......@@ -429,22 +473,22 @@ void DocumentComponent::render() {
transformMatrix[13]=std::max((rootComponent->height)/(windowHeight)*2.0f, 2.0f);
transformMatrixDirty = true;
}
// after we load in the document, allow scroll to work
this->updateMouse();
}
// we have to do this each time because window resets it
//if (transformMatrixDirty) {
//const std::clock_t begin = clock();
Shader *fontShader = this->win->shaderLoader.getShader(VertexShader("FontShader.vert"),
FragmentShader("FontShader.frag"));
GLint transformLocation = fontShader->uniform("transform");
glUniformMatrix4fv(transformLocation, 1, GL_FALSE, transformMatrix);
//const std::clock_t end = clock();
//std::cout << "Updated font matrix in: " << std::fixed << ((static_cast<double>(end - begin)) / CLOCKS_PER_SEC) << std::scientific << " seconds" << std::endl;
Shader *textureShader = this->win->shaderLoader.getShader(VertexShader("TextureShader.vert"),
FragmentShader("TextureShader.frag"));
......@@ -454,7 +498,7 @@ void DocumentComponent::render() {
textureShader->bind();
GLint transformLocation2 = textureShader->uniform("transform");
glUniformMatrix4fv(transformLocation2, 1, GL_FALSE, textureTransformMatrix);
//std::cout << "DocumentComponent::render - start Box components" << std::endl;
//renderBoxComponents(rootComponent);
this->renderComponentType("input", rootComponent);
......@@ -540,18 +584,18 @@ std::shared_ptr<Component> DocumentComponent::searchComponentTree(const std::sha
// preparation for multiple HTML documents
void DocumentComponent::navTo(const std::string url) {
logDebug() << "DocumentComponent::navTo(" << url << ")" << std::endl;
this->currentURL = currentURL.merge(URL(url));
logDebug() << "DocumentComponent::navTo - go to: " << currentURL << std::endl;
//setWindowContent(currentURL);
logDebug() << "main::setWindowContent - " << url << std::endl;
// integrity check
TabbedComponent *tabComponent = dynamic_cast<TabbedComponent*>(this->win->tabComponent.get());
if (!tabComponent->tabs.size()) {
std::cout << "DocumentComponent::navTo - There's a document when there's not tabs" << std::endl;
}
// download URL
WebResource res = getWebResource(this->currentURL);
this->handleResource(res, currentURL.toString());
......@@ -567,23 +611,23 @@ void DocumentComponent::handleResource(WebResource &res, std::string url) {
// bind tag to root
tagNode->parent = rootNode;
rootNode->children.push_back(tagNode);
std::shared_ptr<TextNode> textNode = std::make_shared<TextNode>();
textNode->text = "Invalid Resource Type, HTTP Result Status: " + res.raw;
// bind text to tag
textNode->parent = tagNode;
tagNode->children.push_back(textNode);
// send NodeTree to window
//this->win->setDOM(rootNode);
this->setDOM(rootNode);
}
//std::cout << "body: " << res.raw << std::endl;
//std::cout << "type: " << res.resourceType << std::endl;
// parse HTML
if (res.resourceType == ResourceType::HTML) {
HTMLParser parser;
......@@ -591,11 +635,11 @@ void DocumentComponent::handleResource(WebResource &res, std::string url) {
std::shared_ptr<Node> rootNode = parser.parse(res.raw);
const std::clock_t end = clock();
logDebug() << "DocumentComponent::handleResource - Parsed document in: " << std::fixed << ((static_cast<double>(end - begin)) / CLOCKS_PER_SEC) << std::scientific << " seconds" << std::endl;
// send NodeTree to window
//this->win->setDOM(rootNode);
//printNode(rootNode, 0);
// we need a way to communicate with our tabComponent
// maybe an event is best
if (this->onBeforeLoad) {
......@@ -606,19 +650,19 @@ void DocumentComponent::handleResource(WebResource &res, std::string url) {
std::cout << "DocumentComponent::handleResource - Rendering text document" << std::endl;
std::shared_ptr<Node> rootNode = std::make_shared<Node>(NodeType::ROOT);
std::shared_ptr<TagNode> tagNode = std::make_shared<TagNode>();
tagNode->tag="p";
tagNode->tag = "p";
// bind tag to root
tagNode->parent = rootNode;
rootNode->children.push_back(tagNode);
std::shared_ptr<TextNode> textNode = std::make_shared<TextNode>();
textNode->text = res.raw;
// bind text to tag
textNode->parent = tagNode;
tagNode->children.push_back(textNode);
// send NodeTree to window
//this->win->setDOM(rootNode);
this->setDOM(rootNode);
......
......@@ -6,9 +6,10 @@
#include "MultiComponent.h"
#include "ComponentBuilder.h"
#include "../../parsers/markup/Node.h"
#include "../../URL.h"
#include "../../parsers/scripting/javascript/JSParser.h"
#include "../../networking/HTTPResponse.h"
#include "../../WebResource.h"
#include "../../tools/URL.h"
#include "../../tools/WebResource.h"
std::pair<size_t, size_t> getLine(std::string text, int findLine);
size_t getNumberOfLines(std::string text);
......@@ -31,7 +32,7 @@ public:
//
//int scrollY = 0;
//int scrollHeight = 0;
// FIXME: I don't think we need two matrixes (they scroll in the same direction)
float textureTransformMatrix[16] = {
1, 0, 0, 0,
......@@ -47,6 +48,8 @@ public:
};
bool transformMatrixDirty = true;
std::function<void(std::string url)> onBeforeLoad = nullptr;
std::shared_ptr<JavaScript> mainScript = nullptr;
std::shared_ptr<JavaScript> bootstrapScript = nullptr;
};
......