Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jessica Hawkwell
/
nitrogen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 51bf7aa2
authored
Mar 29, 2018
by
Jessica Hawkwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made it build
1 parent
2ae5f937
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
247 additions
and
44 deletions
CMakeLists.txt
src/libnde/nitrogen/SettingsManager.cpp
src/libnde/nitrogen/SettingsManager.h
src/libntk/CMakeLists.txt
src/libntk/nitrogen/nwt/Component.cpp
src/libntk/nitrogen/nwt/Component.h
src/libntk/nitrogen/util/ComponentRenderer.cpp → src/libntk/nitrogen/nwt/ComponentRenderer.cpp
src/libntk/nitrogen/util/ComponentRenderer.h → src/libntk/nitrogen/nwt/ComponentRenderer.h
src/libntk/nitrogen/nwt/ComponentRendererSVG.cpp
src/libntk/nitrogen/nwt/ComponentRendererSVG.h
src/libntk/nitrogen/nwt/Container.cpp
src/libntk/nitrogen/nwt/Container.h
CMakeLists.txt
View file @
51bf7aa
...
...
@@ -18,5 +18,5 @@ include_directories(AFTER SYSTEM ${CMAKE_BINARY_DIR}/deps/resvg/capi/include/)
add_subdirectory
(
deps
)
add_subdirectory
(
src/libnde
)
#
add_subdirectory(src/libntk)
add_subdirectory
(
src/libntk
)
add_subdirectory
(
src/NitroWin
)
src/libnde/nitrogen/SettingsManager.cpp
0 → 100644
View file @
51bf7aa
/*
* Copyright (c) 2018, jlhawkwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* File: SettingsManager.cpp
* Author: jlhawkwell
*
* Created on March 29, 2018, 9:59 PM
*/
#include "SettingsManager.h"
namespace
nitrogen
{
SettingsManager
::
SettingsManager
()
{
}
}
src/libnde/nitrogen/SettingsManager.h
0 → 100644
View file @
51bf7aa
/*
* Copyright (c) 2018, jlhawkwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* File: SettingsManager.h
* Author: jlhawkwell
*
* Created on March 29, 2018, 9:59 PM
*/
#ifndef SETTINGSMANAGER_H
#define SETTINGSMANAGER_H
#include <nde.h>
namespace
nitrogen
{
class
SettingsManager
:
public
gc
{
public
:
SettingsManager
();
private
:
};
}
#endif
/* SETTINGSMANAGER_H */
src/libntk/CMakeLists.txt
View file @
51bf7aa
...
...
@@ -15,6 +15,8 @@ nitrogen/nwt/Border.cpp
nitrogen/nwt/Color.cpp
nitrogen/nwt/Component.cpp
nitrogen/nwt/ComponentEvent.cpp
nitrogen/nwt/ComponentRenderer.cpp
nitrogen/nwt/ComponentRendererSVG.cpp
nitrogen/nwt/Container.cpp
nitrogen/nwt/Dimension.cpp
nitrogen/nwt/EmptyBorder.cpp
...
...
@@ -32,10 +34,8 @@ nitrogen/nwt/MouseAdapter.cpp
nitrogen/nwt/MouseEvent.cpp
nitrogen/nwt/MouseListener.cpp
nitrogen/nwt/NWTEvent.cpp
nitrogen/nwt/NativeGraphics.cpp
nitrogen/nwt/Point.cpp
nitrogen/nwt/Rectangle.cpp
nitrogen/util/ComponentRenderer.cpp
)
...
...
src/libntk/nitrogen/nwt/Component.cpp
View file @
51bf7aa
...
...
@@ -33,6 +33,8 @@
#include "Component.h"
#include <nitrogen/nwt/ComponentRenderer.h>
namespace
nitrogen
{
namespace
nwt
{
...
...
@@ -50,7 +52,7 @@ namespace nitrogen {
parent
=
nullptr
;
preferredSize
=
new
Rectangle
(
0
,
0
);
renderer
=
new
nitrogen
::
util
::
ComponentRenderer
(
new
std
::
string
(
"Component"
),
this
);
renderer
=
ComponentRenderer
::
create
(
new
std
::
string
(
"Component"
),
this
);
}
Border
*
Component
::
getBorder
()
{
...
...
src/libntk/nitrogen/nwt/Component.h
View file @
51bf7aa
...
...
@@ -46,23 +46,20 @@
#include <nitrogen/nwt/MouseListener.h>
#include <nitrogen/nwt/NWTEvent.h>
#include <nitrogen/nwt/Rectangle.h>
#include <nitrogen/util/ComponentRenderer.h>
#include <vector>
namespace
nitrogen
{
namespace
util
{
}
namespace
nwt
{
class
Border
;
//class nitrogen::util::
ComponentRenderer;
class
ComponentRenderer
;
class
Graphics
;
class
NWTEvent
;
class
MouseEvent
;
class
MouseListener
;
class
Component
:
public
Object
{
friend
class
nitrogen
::
util
::
ComponentRenderer
;
friend
class
ComponentRenderer
;
friend
class
Container
;
public
:
virtual
Border
*
getBorder
();
...
...
@@ -110,7 +107,7 @@ namespace nitrogen {
std
::
vector
<
MouseListener
*>*
ml_list
;
Rectangle
*
preferredSize
;
nitrogen
::
util
::
ComponentRenderer
*
renderer
;
ComponentRenderer
*
renderer
;
Component
();
virtual
void
processEvent
(
NWTEvent
*
e
);
...
...
src/libntk/nitrogen/
util
/ComponentRenderer.cpp
→
src/libntk/nitrogen/
nwt
/ComponentRenderer.cpp
View file @
51bf7aa
...
...
@@ -33,19 +33,26 @@
#include "ComponentRenderer.h"
namespace
nitrogen
{
namespace
util
{
#include <nitrogen/nwt/Color.h>
#include <nitrogen/nwt/Component.h>
ComponentRenderer
::
ComponentRenderer
(
std
::
string
*
componentName
,
nwt
::
Component
*
component
)
{
name
=
componentName
;
comp
=
component
;
init
();
namespace
nitrogen
{
namespace
nwt
{
class
Component
;
ComponentRenderer
*
ComponentRenderer
::
create
(
std
::
string
*
componentName
,
Component
*
component
)
{
ComponentRenderer
*
cr
=
new
ComponentRenderer
();
cr
->
name
=
componentName
;
cr
->
comp
=
component
;
if
(
cr
->
name
!=
nullptr
&&
cr
->
name
->
length
()
>
0
)
{
cr
->
init
();
cr
->
init2
();
}
return
cr
;
}
ComponentRenderer
::
ComponentRenderer
(
std
::
string
&
componentName
,
nwt
::
Component
*
component
)
{
name
=
&
componentName
;
comp
=
component
;
init
();
ComponentRenderer
*
ComponentRenderer
::
create
(
std
::
string
&
componentName
,
Component
*
component
)
{
return
create
(
&
componentName
,
component
);
}
void
ComponentRenderer
::
init
()
{
...
...
@@ -72,14 +79,6 @@ namespace nitrogen {
}
window
=
XCreateSimpleWindow
(
nitrogen
::
disp
,
*
w
,
x
,
y
,
width
,
height
,
0
,
0
,
nwt
::
Color
::
BLUE
->
getARGB
());
XWindowAttributes
attrs
;
XGetWindowAttributes
(
nitrogen
::
disp
,
window
,
&
attrs
);
XRenderPictFormat
*
pf
=
XRenderFindVisualFormat
(
nitrogen
::
disp
,
attrs
.
visual
);
surface
=
cairo_xlib_surface_create_with_xrender_format
(
nitrogen
::
disp
,
window
,
attrs
.
screen
,
pf
,
width
,
height
);
cairo
=
cairo_create
(
surface
);
/*svg_handle = */
resvg_init
();
}
std
::
string
*
ComponentRenderer
::
getName
()
{
...
...
@@ -95,16 +94,6 @@ namespace nitrogen {
}
void
ComponentRenderer
::
renderComponent
()
{
//void resvg_cairo_render_to_canvas(const resvg_render_tree* rtree, const resvg_options* opt, resvg_size size, cairo_t* cr)
resvg_options
ro
;
ro
.
dpi
=
96
;
ro
.
draw_background
=
false
;
ro
.
fit_to
.
type
=
resvg_fit_to_type
::
RESVG_FIT_TO_ZOOM
;
resvg_size
rs
;
rs
.
width
=
comp
->
getSize
()
->
getWidth
();
rs
.
height
=
comp
->
getSize
()
->
getWidth
();
resvg_cairo_render_to_canvas
(
svg_tree
,
&
ro
,
rs
,
cairo
);
}
}
}
src/libntk/nitrogen/
util
/ComponentRenderer.h
→
src/libntk/nitrogen/
nwt
/ComponentRenderer.h
View file @
51bf7aa
...
...
@@ -36,7 +36,7 @@
#include <ntk.h>
#include <nitrogen/nwt/Component.h>
//
#include <nitrogen/nwt/Component.h>
#define RESVG_CAIRO_BACKEND
...
...
@@ -49,12 +49,13 @@
#include <resvg.h>
namespace
nitrogen
{
namespace
util
{
namespace
nwt
{
class
Component
;
class
ComponentRenderer
:
public
Object
{
public
:
ComponentRenderer
(
std
::
string
*
componentName
,
nwt
::
Component
*
component
);
ComponentRenderer
(
std
::
string
&
componentName
,
nwt
::
Component
*
component
);
static
ComponentRenderer
*
create
(
std
::
string
*
componentName
,
Component
*
component
);
static
ComponentRenderer
*
create
(
std
::
string
&
componentName
,
Component
*
component
);
std
::
string
*
getName
();
Window
*
getWindow
();
...
...
@@ -64,15 +65,16 @@ namespace nitrogen {
protected
:
std
::
string
*
name
;
Window
window
;
nwt
::
Component
*
comp
;
Component
*
comp
;
cairo_t
*
cairo
;
cairo_surface_t
*
surface
;
//resvg_handle* svg_handle;
resvg_render_tree
*
svg_tree
;
ComponentRenderer
();
void
init
();
virtual
void
init2
();
private
:
};
}
}
...
...
src/libntk/nitrogen/nwt/ComponentRendererSVG.cpp
0 → 100644
View file @
51bf7aa
/*
* Copyright (c) 2018, jlhawkwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* File: ComponentRendererSVG.cpp
* Author: jlhawkwell
*
* Created on March 29, 2018, 9:14 PM
*/
#include "ComponentRendererSVG.h"
namespace
nitrogen
{
namespace
nwt
{
void
ComponentRendererSVG
::
init2
()
{
unsigned
int
width
=
comp
->
getSize
()
->
getWidth
();
unsigned
int
height
=
comp
->
getSize
()
->
getHeight
();
XWindowAttributes
attrs
;
XGetWindowAttributes
(
nitrogen
::
disp
,
window
,
&
attrs
);
XRenderPictFormat
*
pf
=
XRenderFindVisualFormat
(
nitrogen
::
disp
,
attrs
.
visual
);
surface
=
cairo_xlib_surface_create_with_xrender_format
(
nitrogen
::
disp
,
window
,
attrs
.
screen
,
pf
,
width
,
height
);
cairo
=
cairo_create
(
surface
);
}
void
ComponentRendererSVG
::
renderComponent
()
{
//void resvg_cairo_render_to_canvas(const resvg_render_tree* rtree, const resvg_options* opt, resvg_size size, cairo_t* cr)
resvg_options
ro
;
ro
.
dpi
=
96
;
ro
.
draw_background
=
false
;
ro
.
fit_to
.
type
=
resvg_fit_to_type
::
RESVG_FIT_TO_ZOOM
;
resvg_size
rs
;
rs
.
width
=
comp
->
getSize
()
->
getWidth
();
rs
.
height
=
comp
->
getSize
()
->
getWidth
();
resvg_cairo_render_to_canvas
(
svg_tree
,
&
ro
,
rs
,
cairo
);
}
}
}
src/libntk/nitrogen/nwt/ComponentRendererSVG.h
0 → 100644
View file @
51bf7aa
/*
* Copyright (c) 2018, jlhawkwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* File: ComponentRendererSVG.h
* Author: jlhawkwell
*
* Created on March 29, 2018, 9:14 PM
*/
#ifndef COMPONENTRENDERERSVG_H
#define COMPONENTRENDERERSVG_H
#include <ntk.h>
#include <nitrogen/nwt/Component.h>
#include <nitrogen/nwt/ComponentRenderer.h>
namespace
nitrogen
{
namespace
nwt
{
class
ComponentRendererSVG
:
public
ComponentRenderer
{
public
:
void
renderComponent
()
override
;
protected
:
virtual
void
init2
()
override
;
private
:
ComponentRendererSVG
();
};
}
}
#endif
/* COMPONENTRENDERERSVG_H */
src/libntk/nitrogen/nwt/Container.cpp
View file @
51bf7aa
...
...
@@ -165,6 +165,7 @@ namespace nitrogen {
Container
::
Container
()
{
lst
=
new
std
::
vector
<
Component
*>
();
renderer
=
ComponentRenderer
::
create
(
new
std
::
string
(
"Container"
),
this
);
}
}
...
...
src/libntk/nitrogen/nwt/Container.h
View file @
51bf7aa
...
...
@@ -37,6 +37,7 @@
#include <ntk.h>
#include <nitrogen/nwt/Component.h>
#include <nitrogen/nwt/ComponentRenderer.h>
#include <nitrogen/nwt/Graphics.h>
#include <nitrogen/nwt/LayoutManager.h>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment