Add c file for embedded php wrapper

Add very biased makefile, and update some stuff
This commit is contained in:
Timothy Warren 2012-11-27 22:32:45 -05:00
parent 0f02d9a423
commit b597a7a741
7 changed files with 84 additions and 10 deletions

3
.gitignore vendored
View File

@ -5,3 +5,6 @@ errors.txt
tests/db_files/* tests/db_files/*
test_config.json test_config.json
nbproject/* nbproject/*
*.o
*.app/*
OpenSQLManager

26
OpenSQLManager.c Normal file
View File

@ -0,0 +1,26 @@
/**
* OpenSQLManager
*
* Free Database manager for Open Source Databases
*
* @package OpenSQLManager
* @author Timothy J. Warren
* @copyright Copyright (c) 2012
* @link https://github.com/aviat4ion/OpenSQLManager
* @license https://timshomepage.net/dbaj.txt
*/
/**
* Wrapper program for embeded php
*/
#include <sapi/embed/php_embed.h>
int main(int argc, char *argv[])
{
PHP_EMBED_START_BLOCK(argc,argv)
zend_eval_string("include ('./OpenSQLManager.php');", NULL, "TEST" TSRMLS_CC);
PHP_EMBED_END_BLOCK()
return 0;
}

8
makefile Normal file
View File

@ -0,0 +1,8 @@
CC = gcc
CFLAGS = -c `/opt/php-embed/bin/php-config --includes` -Wall -g
LDFLAGS = -L/Library/Frameworks/Firebird.framework/Libraries -L/opt/php-embed/lib -lphp5 `/opt/php-embed/bin/php-config --libs`
all: OpenSQLManager.c
${CC} -o OpenSQLManager.o OpenSQLManager.c ${CFLAGS}
${CC} -o OpenSQLManager OpenSQLManager.o ${LDFLAGS}

View File

@ -64,6 +64,13 @@ class Connection_Sidebar extends \wxPanel {
*/ */
private $list; private $list;
/**
* Reference to the image list control that holds connection images
*
* @var wxImageList
*/
private $img_list;
/** /**
* Reference to the parent of the current object * Reference to the parent of the current object
* *
@ -174,6 +181,20 @@ class Connection_Sidebar extends \wxPanel {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Connect to the database for data display/manipulation
*
* @param wxEvent
* @return void
*/
public function open_connection($event)
{
$id = $event->GetId();
alert('Double click:' . $id);
}
// --------------------------------------------------------------------------
/** /**
* Add the existing items to the connection sidebar * Add the existing items to the connection sidebar
* *
@ -181,9 +202,18 @@ class Connection_Sidebar extends \wxPanel {
*/ */
public function _layout() public function _layout()
{ {
$this->list = new \wxListCtrl($this->parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_LIST|wxLC_SINGLE_SEL); $this->list = new \wxListCtrl($this->parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_SMALL_ICON | wxLC_SINGLE_SEL | wxLC_ALIGN_TOP);
$this->img_list = new \wxImageList(32, 32);
$this->settings =& Settings::get_instance(); $this->settings =& Settings::get_instance();
$this->list->Connect(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, array($this, 'menu')); $this->list->Connect(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, array($this, 'menu'));
$this->list->Connect(wxEVT_LEFT_DCLICK, array($this, 'open_connection'));
// Add Images to the Image list
foreach(glob(OSM_RESOURCE_DIR.'/images/*.xpm') as $path)
{
//$img = new \wxBitmap($path);
//$this->img_list->Add($img);
}
// Create a button for adding new connections // Create a button for adding new connections
$new_conn = new \wxButton($this, self::BTN_ADD, 'New Connection'); $new_conn = new \wxButton($this, self::BTN_ADD, 'New Connection');

View File

@ -33,9 +33,9 @@ class Data_Grid extends \wxGrid {
if ( ! is_null($parent)) if ( ! is_null($parent))
{ {
parent::__construct($parent, wxID_ANY); parent::__construct($parent, wxID_ANY);
$this->CreateGrid(10,10); $this->CreateGrid(30,8);
$this->HideColLabels(); //$this->HideColLabels();
$this->HideRowLabels(); //$this->HideRowLabels();
} }
else else
{ {

View File

@ -66,7 +66,7 @@ class DB_tabs extends \wxAUINotebook {
*/ */
public function __construct($parent) public function __construct($parent)
{ {
parent::__construct($parent); parent::__construct($parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ALL_TABS | wxAUI_NB_WINDOWLIST_BUTTON);
$this->parent = $parent; $this->parent = $parent;
$this->data = new \StdClass(); $this->data = new \StdClass();
} }

View File

@ -49,6 +49,13 @@ class Main extends \wxFrame {
*/ */
protected $split; protected $split;
/**
* Reference to tab control in split Window
*
* @var wxAUINotebook
*/
protected $tabs;
/** /**
* Create and display the main window on startup * Create and display the main window on startup
*/ */
@ -150,7 +157,6 @@ class Main extends \wxFrame {
// Add the connection sidebar // Add the connection sidebar
$this->connection_sidebar =& Connection_Sidebar::get_instance($win); $this->connection_sidebar =& Connection_Sidebar::get_instance($win);
$win2 = new Db_tabs($win); $win2 = new Db_tabs($win);
$win2->add_tab('Test');
// Add the widgets to the split window // Add the widgets to the split window
$win->SplitVertically($this->connection_sidebar, $win2); $win->SplitVertically($this->connection_sidebar, $win2);
@ -158,6 +164,7 @@ class Main extends \wxFrame {
// Save a reference for later use // Save a reference for later use
$this->split =& $win; $this->split =& $win;
$this->tabs =& $win2;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------