Commit 3a83f00c authored by Claes Sjofors's avatar Claes Sjofors

Merge branch 'master' of 62.20.65.89:/data1/git/pwr

parents 0c9f1106 61876055
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
/* rt_io_m_siemens_diagrepeater.c -- io methods for a Siemens Diagnostic Repeater slave */ /* rt_io_m_siemens_diagrepeater.c -- io methods for a Siemens Diagnostic Repeater slave */
#pragma pack(1)
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
......
...@@ -3699,7 +3699,7 @@ static int ccm_read_file( ...@@ -3699,7 +3699,7 @@ static int ccm_read_file(
{ {
row++; row++;
ccm_remove_blank( str, str); ccm_remove_blank( str, str);
if ( str[0] == '!' || (str[0] == '#' && strncmp( str, "#include", 8) != 0)) if ( str[0] == '!' || str[0] == 0 || (str[0] == '#' && strncmp( str, "#include", 8) != 0))
continue; continue;
/* If last char i backslash, concatenate next line */ /* If last char i backslash, concatenate next line */
while( str[strlen(str)-1] == '\\') while( str[strlen(str)-1] == '\\')
......
...@@ -2611,12 +2611,12 @@ char *cdh_Strncpy( char *dest, const char *src, size_t n) ...@@ -2611,12 +2611,12 @@ char *cdh_Strncpy( char *dest, const char *src, size_t n)
int cdh_StrncpyCutOff( char *t, const char *s, size_t n, int cutleft) int cdh_StrncpyCutOff( char *t, const char *s, size_t n, int cutleft)
{ {
if ( strlen(s) < n) { if ( strlen(s) < n) {
strcpy( t, s); cdh_Strcpy( t, s);
return 0; return 0;
} }
if ( cutleft) { if ( cutleft) {
strcpy( t, s + strlen(s) - n + 1); cdh_Strcpy( t, s + strlen(s) - n + 1);
if ( n > 5) { if ( n > 5) {
t[0] = '.'; t[0] = '.';
t[1] = '.'; t[1] = '.';
...@@ -2624,7 +2624,7 @@ int cdh_StrncpyCutOff( char *t, const char *s, size_t n, int cutleft) ...@@ -2624,7 +2624,7 @@ int cdh_StrncpyCutOff( char *t, const char *s, size_t n, int cutleft)
} }
} }
else { else {
strncpy( t, s, n); cdh_Strncpy( t, s, n);
t[n-1] = 0; t[n-1] = 0;
if ( n > 5) { if ( n > 5) {
t[n-2] = '.'; t[n-2] = '.';
......
...@@ -151,7 +151,7 @@ static int nav_remove_spaces( ...@@ -151,7 +151,7 @@ static int nav_remove_spaces(
for ( s = in; !((*s == 0) || ((*s != ' ') && (*s != 9))); s++); for ( s = in; !((*s == 0) || ((*s != ' ') && (*s != 9))); s++);
strcpy( out, s); cdh_Strcpy( out, s);
if ( strlen(s) != 0) if ( strlen(s) != 0)
{ {
......
Description of how to create a Proview Live CD.
Install Ubuntu Customization Kit, UCK.
On Ubuntu 10.10 gfxboot-dev has to be installed and
> ln -s /usr/bin/gfxboot-compile /usr/bin/mkbootmsg
Check the versions of libmysql++, libjs-mootools, midori, thttp and pv in
build.sh. Also in pwr_install.sh.
Download pwr48 and pwrdemo48 packages to HOME directory. Check versions
in build.sh and pwr_install.sh.
Check the host name and plc version in pwr_renamenode.sh.
Download the Ubuntu iso image file.
Run build.sh to download packages.
Run uck-gui and follow the instructions from the previous command.
Run 'build.sh copy' when the customization console is opened.
\ No newline at end of file
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Backup
Type=Application
Comment=Backup your Proview configuration
Exec=xterm -title "Proview Configuration Backup" -e /home/pwrp/backup-script.sh
Icon=drive-removable-media.png
Categories=GNOME;GTK;Application;
#!/bin/bash
lsof 2>&1 | grep -cqE 'usr/(local/)?pwr' && zenity --info --text "There are files in /usr/pwr* in use. It is strongly recommended to close all Proview instances and files before continuing."
medialist=$(mount | awk '/on \/media\// {print $3}')
echo -n "Found media:"
if [[ -z "$medialist" ]] ; then
echo " NONE"
zenity --error --text "No backup media found.\n\nPlease mount an external storage device such as an USB flash drive."
exit 2
else
echo
echo $medialist
fi
media=$(echo $medialist | zenity --list --text "Please select the mass storage to backup your Proview data to:" --column=Media)
if [[ -z "$media" ]] ; then
echo "You have to select a media to store the data on" >&2
zenity --error --text "You have to select a media to store the data on."
exit 1
else
echo "Using \"$media\" for backup"
fi
echo "Compressing data, please wait ..."
target="${media}/proview-livecd-backup.tar.lzma"
cd /
nice sudo /bin/tar -cp --exclude '*.lock' usr/local/pwr* usr/pwrp/adm | pv | nice -n 19 lzma >${target} || zenity --error --text "Creating the backup failed.\n\nPlease check the error messages as shown in the terminal."
ls -l ${target}
test -s "${target}" && zenity --info --text 'The backup has been saved as\n\n'"${target}"
sleep 5
#!/bin/bash
#pwrpkg_dir=$pwre_broot/os_linux/hw_x86/bld/pkg
pwrpkg_dir=~
customize_dir=~/tmp/remaster-root/tmp
apt_cache=/var/cache/apt/archives
libn1="libmysql++"
lib1="libmysql++3_3.0.9-1ubuntu2_i386.deb"
libn2="libjs-mootools"
lib2="libjs-mootools_1.2.4.0~debian1-1_all.deb"
libn3="midori"
lib3="midori_0.2.4-3_i386.deb"
libn4="thttpd"
lib4="thttpd_2.25b-11_i386.deb"
libn5="pv"
lib5="pv_1.1.4-1_i386.deb"
if [ "$1" == "" ]; then
# Check packages
let notfound=0
if [ ! -e $apt_cache/$lib1 ]; then
echo "-- Downloading $apt_cache/$lib1"
sudo apt-get install --reinstall -d $libn1
notfound=1
fi
if [ ! -e $apt_cache/$lib2 ]; then
echo "-- Downloading $apt_cache/$lib2"
sudo apt-get install --reinstall -d $libn2
notfound=1
fi
if [ ! -e $apt_cache/$lib3 ]; then
echo "-- Downloading $apt_cache/$lib3"
sudo apt-get install --reinstall -d $libn3
notfound=1
fi
if [ ! -e $apt_cache/$lib4 ]; then
echo "-- Downloading $apt_cache/$lib4"
sudo apt-get install --reinstall -d $libn4
notfound=1
fi
if [ ! -e $apt_cache/$lib5 ]; then
echo "-- Downloading $apt_cache/$lib5"
sudo apt-get install --reinstall -d $libn5
notfound=1
fi
echo ""
echo " Start UCK with"
echo ""
echo " > uck-gui"
echo ""
echo " Questions: - Language: en"
echo " - Customize the CD: yes"
echo " - Name: Proview LiveCD"
echo " - Delete files: no"
echo " - Choose actions: Run console application"
echo ""
echo " Then start build.sh with argument \"copy\" when the"
echo " UCK customization console is opened"
echo ""
elif [ "$1" == "copy" ]; then
#
# Copy packages to customize dir
cp $pwrpkg_dir/pwr48_4.8.0-1_i386.deb $customize_dir/
cp $pwrpkg_dir/pwrdemo48_4.8.0-1_i386.deb $customize_dir/
#
# Copy installation-scripts and setup
cp ./pwr_customize.sh $customize_dir/
cp ./pwr_install.sh $customize_dir/
cp ./pwr_renamenode.sh $customize_dir/
cp ./pwr_remove.sh $customize_dir/
cp ./casper.conf $customize_dir/
cp ./custom.conf $customize_dir/
#
# Scripts, icons and settings for user pwrp
cp ./backup-script.sh $customize_dir/
cp ./restore-script.sh $customize_dir/
cp ./demoweb-script.sh $customize_dir/
cp ./backup-script.desktop $customize_dir/
cp ./restore-script.desktop $customize_dir/
cp ./pwrdemoweb.desktop $customize_dir/
cp ./welcome.html $customize_dir/
cp ./midori.desktop $customize_dir/
cp ./pwr_gconf_config_local.tar.gz $customize_dir/
#
# Debian packages
cp $apt_cache/$lib1 $customize_dir/
cp $apt_cache/$lib2 $customize_dir/
cp $apt_cache/$lib3 $customize_dir/
cp $apt_cache/$lib4 $customize_dir/
cp $apt_cache/$lib5 $customize_dir/
echo ""
echo " Execute "
echo ""
echo " > cd /tmp"
echo " > ./pwr_customize.sh"
echo ""
echo " in the UCK customization console"
echo ""
fi
# This file should go in /etc/casper.conf
# Supported variables are:
# USERNAME, USERFULLNAME, HOST, BUILD_SYSTEM
export USERNAME="pwrp"
export USERFULLNAME="Proview user"
export HOST="ubuntu"
export BUILD_SYSTEM="Ubuntu"
[daemon]
AutomaticLoginEnable=true
AutomaticLogin=pwrp
#! /bin/bash
initst=`eval pidof rt_ini`
if [ -z $initst ]; then
source /etc/pwrp_profile
export pwra_db=/usr/pwrp/adm/db
source $pwra_db/pwr_setup.sh
source $pwra_db/pwra_env.sh set project pwrdemo48
export PWR_BUS_ID=999
source pwr_stop.sh
rt_ini &
sleep 10
initst=`eval pidof rt_ini`
if [ -z $initst ]; then
zenity --error --text "Unable to start the Demo Project Runtime Enviroment"
source pwr_stop.sh
exit
fi
fi
firefox http://ubuntu/index.html
source pwr_stop.sh
[Desktop Entry]
Type=Application
Exec=/usr/bin/midori /home/pwrp/welcome.html
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[C]=Welcome
Name=Welcome
Comment[C]=Show warm welcome to user
Comment=Show warm welcome to user
#cd /root/pwr
./pwr_install.sh
./pwr_remove.sh
#rm /tmp/*
#
# Install
apt-get -y install libdb4.8
apt-get -y install libdb4.8++
apt-get -y install g++
apt-get -y install mysql-common
apt-get -y install libmysqlclient16
dpkg -i libmysql++3_3.0.9-1ubuntu2_i386.deb
dpkg -i pwr48_4.8.0-1_i386.deb
dpkg -i pwrdemo48_4.8.0-1_i386.deb
apt-get -y install midori
apt-get -y install default-jre-headless
ln -s /usr/lib/jvm/default-java/jre /usr/local/jre
apt-get -y install firefox
apt-get -y install icedtea6-plugin
dpkg -i thttpd_2.25b-11_i386.deb
dpkg -i pv_1.1.4-1_i386.deb
#
# Configure
chmod a+w /etc/casper.conf
cp ./casper.conf /etc/
cp ./custom.conf /etc/gdm/
sed -i 's/no/yes/g' /etc/default/thttpd
sed -i 's/sudo:x:27:/sudo:x:27:pwrp/g' /etc/group
#
# Add pwrp to sudoers
chmod u+s /etc/sudoers
echo "pwrp ALL= NOPASSWD: ALL" >> /etc/sudoers
chmod u-s /etc/sudoers
#
# Rename host nodename to livecd nodename in proview files
/tmp/pwr_renamenode.sh
#
# User pwrp
cp ./backup-script.sh /home/pwrp/
cp ./restore-script.sh /home/pwrp/
cp ./demoweb-script.sh /home/pwrp/
chmod a+x /home/pwrp/*.sh
cp ./backup-script.desktop /home/pwrp/Desktop/
cp ./restore-script.desktop /home/pwrp/Desktop/
cp ./pwrdemoweb.desktop /home/pwrp/Desktop
chmod a+x /home/pwrp/Desktop/*.desktop
cp ./welcome.html /home/pwrp/
mkdir -p /home/pwrp/.config/autostart
cp ./midori.desktop /home/pwrp/.config/autostart
chmod a+x /home/pwrp/.config/autostart/midori.desktop
tar --directory /home/pwrp -xzf ./pwr_gconf_config_local.tar.gz
chown -R pwrp:pwrp /home/pwrp/*
chown -R pwrp:pwrp /home/pwrp/.*
#
# Web
cp /usr/pwrp/pwrdemo48/bld/common/web/* /var/www/
cp /usr/pwrp/pwrdemo48/bld/common/load/*.flw /var/www/
cp /usr/pwrp/pwrdemo48/bld/common/load/*rtt*.dat /var/www/
cp /usr/pwr48/os_linux/hw_x86/exp/lib/pwr_jopc.jar /var/www/
cp /usr/pwr48/os_linux/hw_x86/exp/lib/pwr_jop.jar /var/www/
cp /usr/pwr48/os_linux/hw_x86/exp/lib/pwr_rt_client.jar /var/www/
cp /usr/pwr48/os_linux/hw_x86/exp/exe/pwr_logga.gif /var/www/
#
# Midori
dpkg -i libjs-mootools_1.2.4.0~debian1-1_all.deb
dpkg -i midori_0.2.4-3_i386.deb
#
# Clean
#rm /tmp/*.deb
rm -r /usr/pwr48/os_linux/hw_x86/exp/doc/*
rm /usr/pwr48/os_linux/hw_x86/exp/exe/co_help_gtk
rm /usr/pwr48/os_linux/hw_x86/exp/exe/sev_xtt_gtk
rm /usr/pwr48/os_linux/hw_x86/exp/exe/wb_cmd_gtk
rm /usr/pwr48/os_linux/hw_x86/exp/exe/wb_ge_gtk
rm /usr/pwr48/os_linux/hw_x86/exp/exe/xtt_ge_jprint
rm /usr/pwr48/os_linux/hw_x86/exp/exe/wb_upgrade
rm /usr/pwr48/os_linux/hw_x86/exp/exe/wb_rtt
rm /usr/pwr48/os_linux/hw_x86/exp/exe/wb_ldlist
chown -R pwrp:pwrp /usr/pwrp
chown -R pwrp:pwrp /usr/local/pwrp
apt-get -y remove aisleriot
apt-get -y remove gbrainy
apt-get -y remove gnome-mahjongg
apt-get -y remove gnome-sudoku
apt-get -y remove gnomine
apt-get -y remove gnome-games-common
apt-get -y remove openoffice.org-core
#apt-get -y remove firefox
apt-get -y remove bogofilter-common
apt-get -y remove shotwell
apt-get -y remove brasero-common
apt-get -y remove pitivi
apt-get -y remove rhythmbox
apt-get -y remove totem
apt-get -y remove totem-common
apt-get -y remove aspell
apt-get -y remove evolution
apt-get -y remove empathy-common
apt-get -y remove gwibber
apt-get -y remove gwibber-service
apt-get -y remove gdb
apt-get -y remove nano
apt-get -y remove sane-utils
apt-get -y remove min12xxw
apt-get -y remove erlang-base
apt-get -y remove icedtea-6-jre-cacao
apt-get -y remove libcanberra-pulse
apt-get -y remove lp-solve
apt-get -y remove speech-dispatcher
#
# Remove to avoid Try/Install screen
apt-get -y remove ubiquity
broot=/usr/pwrp/pwrdemo48/bld
sed -i 's/red-ant/ubuntu/g' $broot/common/load/ld_boot_red-ant_0999.dat
sed -i 's/red-ant/ubuntu/g' $broot/common/load/ld_node_red-ant_0999.dat
mv $broot/common/load/ld_boot_red-ant_0999.dat $broot/common/load/ld_boot_ubuntu_0999.dat
mv $broot/common/load/ld_node_red-ant_0999.dat $broot/common/load/ld_node_ubuntu_0999.dat
mv $broot/common/load/ld_appl_red-ant_999.txt $broot/common/load/ld_appl_ubuntu_999.txt
mv $broot/x86_linux/exe/plc_red-ant_0999_00005 $broot/x86_linux/exe/plc_ubuntu_0999_00005
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Name=Proview Demo Web
Comment=Start Proview Demo Web
GenericName=Web Browser
Exec=xterm -title "Proview Web Demo Console" -e /home/pwrp/demoweb-script.sh
Terminal=false
Type=Application
Icon=/usr/pwrp/adm/db/proview_icon.png
Categories=Application;Internet;Network;WebBrowser;
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Restore
Type=Application
Comment=Restore your Proview configuration
Exec=xterm -title "Proview Configuration Restore" -e /home/pwrp/restore-script.sh
Icon=drive-removable-media.png
Categories=GNOME;GTK;Application;
#!/bin/bash
lsof 2>&1 | grep -cqE 'usr/(local/)?pwr' && zenity --info --text "There are files in /usr/pwr* in use. It is strongly recommended to close all Proview instances and files before continuing."
medialist=$(mount | awk '/on \/media\// {print $3}')
echo -n "Found media:"
if [[ -z "$medialist" ]] ; then
echo " NONE"
zenity --error --text "No backup media found.\n\nPlease mount an external storage device such as an USB flash drive."
exit 2
else
echo
echo $medialist
fi
media=$(echo $medialist | zenity --list --text "Please select the mass storage to restore your Proview data from:" --column=Media)
if [[ -z "$media" ]] ; then
echo "You have to select a media to restore the data from" >&2
zenity --error --text "You have to select a media to restore the data from."
exit 1
else
echo "Using \"$media\" for restore"
fi
target="${media}/proview-livecd-backup.tar.lzma"
if [[ ! -f "${target}" ]] ; then
echo "Backup file does not exist: ${target}" >&2
zenity --error --text "Backup file does not exist:\n\n${target}"
exit 2
fi
# make backup of old files & directories to be overwritten by this restore script
cd /usr/local
sudo /bin/rm -rf _backup_pwr*
for old in pwr* ; do test -e "$old" && sudo /bin/mv "$old" "_backup_$old" ; done
sudo /bin/rm -rf /usr/pwrp/_backup_adm
test -e /usr/pwrp/adm && sudo /bin/mv /usr/pwrp/adm /usr/pwrp/_backup_adm
nice -n 19 unlzma <${target} | pv | nice sudo /bin/tar -xp -C /
if [ $? ] ; then
ls -l ${target}
zenity --info --text "Restoring the backup succeeded.\n\nStill, please check that there are no error messages shown in the terminal."
# remove temporary backup
cd /usr/local
sudo /bin/rm -rf _backup_pwr*
sudo /bin/rm -rf /usr/pwrp/_backup_adm
else
ls -l ${target}
zenity --error --text "Restoring the backup failed.\n\nPlease check the error messages as shown in the terminal."
# restore went wrong, restore previous state
cd /usr/local
sudo /bin/rm -rf pwr*
sudo /bin/rm -rf /usr/pwrp/adm
for old in _backup_pwr* ; do test -e "$old" && sudo /bin/mv "$old" "${old/_backup_}" ; done
test -e /usr/pwrp/_backup_adm && sudo /bin/mv /usr/pwrp/_backup_adm /usr/pwrp/adm
fi
sleep 5
<html>
<head>
<title>Welcome to the Proview Live CD</title>
</head>
<body>
<h1>Welcome to the Proview Live CD</h1>
<p><strong>Thank you</strong> for downloading and testing this Live CD.
We hope it will give you a good first impression what <a href="http://www.proview.se/">Proview</a> is and how to use it.</p>
<p>This browser has several bookmarks preconfigured, e.g. pointing to Proview's <a href="http://www.proview.se/index.php?option=com_joomlaboard&Itemid=24&task=listcat&catid=1">forum</a> or <a href="http://www.proview.se/index.php?option=com_content&task=view&id=15&Itemid=23">documentation</a>.</p>
<p>You may want to get started by running the demo by clicking on the &quot;Proview Demo&quot; icon on the desktop or by reading the <a href="http://www.proview.se/files/doc/pwr_doc/en_us/man_gsg.pdf">&quot;Getting Started&quot; documentation</a> <small>(click on &quot;Open&quot; if asked)</small>.</p>
<p>As we are constantly looking into improving both Proview and this Live CD, please <a href="http://www.proview.se/index.php?option=com_joomlaboard&Itemid=24&task=listcat&catid=1">share your ideas in the forum</a>.</p>
<p>Have fun with Proview!<br/><i>The Proview team</i></p>
</body></html>
...@@ -378,7 +378,7 @@ wb_attribute wb_volume::attribute(const pwr_sAttrRef* arp) const ...@@ -378,7 +378,7 @@ wb_attribute wb_volume::attribute(const pwr_sAttrRef* arp) const
} }
// Check if we shall reference the whole object // Check if we shall reference the whole object
if (arp->Size == 0 || if ((arp->Size == 0 && arp->Offset == 0) ||
(arp->Offset == 0 && arp->Size == bdrep->size() && bdrep->nAttribute() != 1)) { (arp->Offset == 0 && arp->Size == bdrep->size() && bdrep->nAttribute() != 1)) {
wb_attribute a(sts, orep); wb_attribute a(sts, orep);
orep->unref(); orep->unref();
......
...@@ -1687,17 +1687,26 @@ void FlowDrawXLib::set_white_background( FlowCtx *ctx) ...@@ -1687,17 +1687,26 @@ void FlowDrawXLib::set_white_background( FlowCtx *ctx)
int FlowDrawXLib::image_get_width( flow_tImImage image) int FlowDrawXLib::image_get_width( flow_tImImage image)
{ {
#if defined IMLIB
return ((ImlibImage *)image)->rgb_width; return ((ImlibImage *)image)->rgb_width;
#else
return 0;
#endif
} }
int FlowDrawXLib::image_get_height( flow_tImImage image) int FlowDrawXLib::image_get_height( flow_tImImage image)
{ {
#if defined IMLIB
return ((ImlibImage *)image)->rgb_height; return ((ImlibImage *)image)->rgb_height;
#else
return 0;
#endif
} }
void FlowDrawXLib::image_scale( float scale, flow_tImImage *im, flow_tPixmap *im_pixmap, void FlowDrawXLib::image_scale( float scale, flow_tImImage *im, flow_tPixmap *im_pixmap,
flow_tPixmap *im_mask) flow_tPixmap *im_mask)
{ {
#if defined IMLIB
int current_width = int( ((ImlibImage *)*im)->rgb_width * scale); int current_width = int( ((ImlibImage *)*im)->rgb_width * scale);
int current_height = int( ((ImlibImage *)*im)->rgb_height * scale); int current_height = int( ((ImlibImage *)*im)->rgb_height * scale);
...@@ -1707,6 +1716,7 @@ void FlowDrawXLib::image_scale( float scale, flow_tImImage *im, flow_tPixmap *im ...@@ -1707,6 +1716,7 @@ void FlowDrawXLib::image_scale( float scale, flow_tImImage *im, flow_tPixmap *im
Imlib_free_pixmap( (ImlibData *)imlib, (Pixmap)*im_pixmap); Imlib_free_pixmap( (ImlibData *)imlib, (Pixmap)*im_pixmap);
*im_pixmap = (flow_tPixmap) Imlib_move_image( (ImlibData *)imlib, (ImlibImage *)*im); *im_pixmap = (flow_tPixmap) Imlib_move_image( (ImlibData *)imlib, (ImlibImage *)*im);
*im_mask = (flow_tPixmap) Imlib_move_mask( (ImlibData *)imlib, (ImlibImage *)*im); *im_mask = (flow_tPixmap) Imlib_move_mask( (ImlibData *)imlib, (ImlibImage *)*im);
#endif
} }
int FlowDrawXLib::image_load( const char *imagefile, float scale, float nav_scale, int FlowDrawXLib::image_load( const char *imagefile, float scale, float nav_scale,
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#if defined OS_LINUX #if defined OS_LINUX
#define IMLIB 1 // #define IMLIB 1
#endif #endif
#if defined IMLIB #if defined IMLIB
......
...@@ -812,6 +812,9 @@ int FlowCtx::event_handler( flow_eEvent event, int x, int y, int w, int h) ...@@ -812,6 +812,9 @@ int FlowCtx::event_handler( flow_eEvent event, int x, int y, int w, int h)
FlowCtx *ctx; FlowCtx *ctx;
int node_move_event = 0; int node_move_event = 0;
if ( event < flow_eEvent_Null || event >= flow_eEvent__)
return 0;
ctx = this; ctx = this;
// cout << "Event: " << event << endl; // cout << "Event: " << event << endl;
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#include <stdlib.h> #include <stdlib.h>
#if defined OS_LINUX
#define IMLIB 1
#endif
class FlowCtx; class FlowCtx;
class FlowDraw { class FlowDraw {
......
...@@ -2813,26 +2813,43 @@ x/scalex/width << " " << (y - height*scaley)/scaley/height << " translate" << en ...@@ -2813,26 +2813,43 @@ x/scalex/width << " " << (y - height*scaley)/scaley/height << " translate" << en
// Image functions // Image functions
int GlowDrawXLib::image_get_width( glow_tImImage image) int GlowDrawXLib::image_get_width( glow_tImImage image)
{ {
#if defined IMLIB
return ((ImlibImage *)image)->rgb_width; return ((ImlibImage *)image)->rgb_width;
#else
return 0;
#endif
} }
int GlowDrawXLib::image_get_height( glow_tImImage image) int GlowDrawXLib::image_get_height( glow_tImImage image)
{ {
#if defined IMLIB
return ((ImlibImage *)image)->rgb_height; return ((ImlibImage *)image)->rgb_height;
#else
return 0;
#endif
} }
int GlowDrawXLib::image_get_rowstride( glow_tImImage image) int GlowDrawXLib::image_get_rowstride( glow_tImImage image)
{ {
#if defined IMLIB
return ((ImlibImage *)image)->rgb_width; return ((ImlibImage *)image)->rgb_width;
#else
return 0;
#endif
} }
unsigned char *GlowDrawXLib::image_get_data( glow_tImImage image) unsigned char *GlowDrawXLib::image_get_data( glow_tImImage image)
{ {
#if defined IMLIB
return ((ImlibImage *)image)->rgb_data; return ((ImlibImage *)image)->rgb_data;
#else
return 0;
#endif
} }
void GlowDrawXLib::image_rotate( glow_tImImage *image, int to_rotation, int from_rotation) void GlowDrawXLib::image_rotate( glow_tImImage *image, int to_rotation, int from_rotation)
{ {
#if defined IMLIB
int drot = to_rotation - from_rotation; int drot = to_rotation - from_rotation;
drot = int( (float(drot) / 360 - floor( float(drot) / 360)) * 360); drot = int( (float(drot) / 360 - floor( float(drot) / 360)) * 360);
printf( "Drot: %d\n", drot); printf( "Drot: %d\n", drot);
...@@ -2845,16 +2862,21 @@ void GlowDrawXLib::image_rotate( glow_tImImage *image, int to_rotation, int from ...@@ -2845,16 +2862,21 @@ void GlowDrawXLib::image_rotate( glow_tImImage *image, int to_rotation, int from
if ( drot == 90 || drot == 180) if ( drot == 90 || drot == 180)
Imlib_flip_image_horizontal( (ImlibData *)imlib, (ImlibImage *)*image); Imlib_flip_image_horizontal( (ImlibData *)imlib, (ImlibImage *)*image);
} }
#endif
} }
void GlowDrawXLib::image_flip_vertical( glow_tImImage *image) void GlowDrawXLib::image_flip_vertical( glow_tImImage *image)
{ {
#if defined IMLIB
Imlib_flip_image_horizontal( (ImlibData *)imlib, (ImlibImage *)*image); Imlib_flip_image_horizontal( (ImlibData *)imlib, (ImlibImage *)*image);
#endif
} }
void GlowDrawXLib::image_flip_horizontal( glow_tImImage *image) void GlowDrawXLib::image_flip_horizontal( glow_tImImage *image)
{ {
#if defined IMLIB
Imlib_flip_image_vertical( (ImlibData *)imlib, (ImlibImage *)*image); Imlib_flip_image_vertical( (ImlibData *)imlib, (ImlibImage *)*image);
#endif
} }
void GlowDrawXLib::image_scale( int width, int height, glow_tImImage orig_im, glow_tImImage *im, void GlowDrawXLib::image_scale( int width, int height, glow_tImImage orig_im, glow_tImImage *im,
...@@ -2918,17 +2940,22 @@ int GlowDrawXLib::image_render( int width, int height, ...@@ -2918,17 +2940,22 @@ int GlowDrawXLib::image_render( int width, int height,
void GlowDrawXLib::image_free( glow_tImImage image) void GlowDrawXLib::image_free( glow_tImImage image)
{ {
#if defined IMLIB
Imlib_destroy_image( (ImlibData *)imlib, (ImlibImage *)image); Imlib_destroy_image( (ImlibData *)imlib, (ImlibImage *)image);
#endif
} }
void GlowDrawXLib::pixmap_free( glow_tPixmap pixmap) void GlowDrawXLib::pixmap_free( glow_tPixmap pixmap)
{ {
#if defined IMLIB
Imlib_free_pixmap( (ImlibData *)imlib, (Pixmap)pixmap); Imlib_free_pixmap( (ImlibData *)imlib, (Pixmap)pixmap);
#endif
} }
void GlowDrawXLib::image_pixel_iter( glow_tImImage orig_image, glow_tImImage *image, void GlowDrawXLib::image_pixel_iter( glow_tImImage orig_image, glow_tImImage *image,
void (* pixel_cb)(void *, unsigned char *), void *userdata) void (* pixel_cb)(void *, unsigned char *), void *userdata)
{ {
#if defined IMLIB
unsigned char *rgb; unsigned char *rgb;
int rgb_height; int rgb_height;
int rgb_width; int rgb_width;
...@@ -2957,4 +2984,5 @@ void GlowDrawXLib::image_pixel_iter( glow_tImImage orig_image, glow_tImImage *im ...@@ -2957,4 +2984,5 @@ void GlowDrawXLib::image_pixel_iter( glow_tImImage orig_image, glow_tImImage *im
} }
Imlib_changed_image( (ImlibData *)imlib, (ImlibImage *)*image); Imlib_changed_image( (ImlibData *)imlib, (ImlibImage *)*image);
#endif
} }
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#if defined OS_LINUX #if defined OS_LINUX
#define IMLIB 1 // #define IMLIB 1
#endif #endif
#if defined IMLIB #if defined IMLIB
......
...@@ -933,6 +933,9 @@ int GlowCtx::event_handler( glow_eEvent event, int x, int y, int w, int h) ...@@ -933,6 +933,9 @@ int GlowCtx::event_handler( glow_eEvent event, int x, int y, int w, int h)
GlowCtx *ctx; GlowCtx *ctx;
int node_move_event = 0; int node_move_event = 0;
if ( event < glow_eEvent_Null || event >= glow_eEvent__)
return 0;
if ( ctx_type == glow_eCtxType_Grow || ctx_type == glow_eCtxType_Curve) if ( ctx_type == glow_eCtxType_Grow || ctx_type == glow_eCtxType_Curve)
return ((GrowCtx *)this)->event_handler( event, x, y, w, h); return ((GrowCtx *)this)->event_handler( event, x, y, w, h);
else if ( ctx_type == glow_eCtxType_ColPal) else if ( ctx_type == glow_eCtxType_ColPal)
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#include <stdlib.h> #include <stdlib.h>
#if defined OS_LINUX
#define IMLIB 1
#endif
#define DRAW_CLIP_SIZE 10 #define DRAW_CLIP_SIZE 10
class GlowCtx; class GlowCtx;
......
...@@ -1580,7 +1580,7 @@ int ItemMenu::open_children( XNavBrow *brow, double x, double y) ...@@ -1580,7 +1580,7 @@ int ItemMenu::open_children( XNavBrow *brow, double x, double y)
if ( !brow_IsOpen( node)) if ( !brow_IsOpen( node))
action_open = 1; action_open = 1;
} }
if ( action_open || is_root) if ( is_root || action_open)
{ {
// Display childlist // Display childlist
Item *item; Item *item;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment