diff --git a/.gitignore b/.gitignore index e3bbc07..909916f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,16 +9,10 @@ *.bak # Binary files -*.a -*.o -*.dll -*.dll.def *.exe -*.so +*.o # Project files -*.carxp -*.carxs *.pro.user # C++ files @@ -35,39 +29,9 @@ src/resources_rc.py qrc_resources*.cpp # Binaries -carla-bridge-qtcreator -carla-bridge-native -carla-bridge-posix32 -carla-bridge-posix64 -carla-bridge-lv2-cocoa -carla-bridge-lv2-gtk2 -carla-bridge-lv2-gtk3 -carla-bridge-lv2-qt4 -carla-bridge-lv2-qt5 -carla-bridge-lv2-x11 -carla-bridge-vst-cocoa -carla-bridge-vst-x11 - -carla-discovery-qtcreator -carla-discovery-native -carla-discovery-posix32 -carla-discovery-posix64 - c++/jackmeter/cadence-jackmeter c++/xycontroller/cadence-xycontroller -# VST SDK -c++/carla-includes/vst/ - -# Docs -doc/caitlib/ -doc/carla-backend/ -doc/carla-bridge/ -doc/carla-engine/ -doc/carla-native/ -doc/carla-plugin/ -doc/distrho/ - # CX-Freeze builds src/dist/ @@ -75,73 +39,5 @@ src/dist/ *-build-*Debug/ *-build-*Release/ -# ZynAddSubFX UI -c++/carla-native/zynaddsubfx/UI/ADnoteUI.cc -c++/carla-native/zynaddsubfx/UI/ADnoteUI.h -c++/carla-native/zynaddsubfx/UI/BankUI.cc -c++/carla-native/zynaddsubfx/UI/BankUI.h -c++/carla-native/zynaddsubfx/UI/ConfigUI.cc -c++/carla-native/zynaddsubfx/UI/ConfigUI.h -c++/carla-native/zynaddsubfx/UI/EffUI.cc -c++/carla-native/zynaddsubfx/UI/EffUI.h -c++/carla-native/zynaddsubfx/UI/EnvelopeUI.cc -c++/carla-native/zynaddsubfx/UI/EnvelopeUI.h -c++/carla-native/zynaddsubfx/UI/FilterUI.cc -c++/carla-native/zynaddsubfx/UI/FilterUI.h -c++/carla-native/zynaddsubfx/UI/LFOUI.cc -c++/carla-native/zynaddsubfx/UI/LFOUI.h -c++/carla-native/zynaddsubfx/UI/MasterUI.cc -c++/carla-native/zynaddsubfx/UI/MasterUI.h -c++/carla-native/zynaddsubfx/UI/MicrotonalUI.cc -c++/carla-native/zynaddsubfx/UI/MicrotonalUI.h -c++/carla-native/zynaddsubfx/UI/OscilGenUI.cc -c++/carla-native/zynaddsubfx/UI/OscilGenUI.h -c++/carla-native/zynaddsubfx/UI/PADnoteUI.cc -c++/carla-native/zynaddsubfx/UI/PADnoteUI.h -c++/carla-native/zynaddsubfx/UI/PartUI.cc -c++/carla-native/zynaddsubfx/UI/PartUI.h -c++/carla-native/zynaddsubfx/UI/PresetsUI.cc -c++/carla-native/zynaddsubfx/UI/PresetsUI.h -c++/carla-native/zynaddsubfx/UI/ResonanceUI.cc -c++/carla-native/zynaddsubfx/UI/ResonanceUI.h -c++/carla-native/zynaddsubfx/UI/SUBnoteUI.cc -c++/carla-native/zynaddsubfx/UI/SUBnoteUI.h -c++/carla-native/zynaddsubfx/UI/VirKeyboard.cc -c++/carla-native/zynaddsubfx/UI/VirKeyboard.h - -# Incoming -_/ -all-recheck -c++/caitlyn/ -c++/carla-backend/carla-dynamic.lv2/ -c++/carla-backend/carla_backend_lv2.cpp -c++/carla-backend/carla_backend_vst.cpp -c++/carla-backend/old/ -c++/carla-bridge/qt-plugin/ -c++/carla-bridge/qtcreator/Makefile -c++/carla-includes/lv2/dynmanifest.h -c++/carla-includes/lv2/morph.h -c++/carla-jackbridge/jack -c++/flmixer/ -c++/widgets/ledbutton.* -c++/widgets/paramspinbox.* -data/templates/energyXT.xt -src/old/ -src/ui/carla_driver.ui - # Other -c++/carla-backend/carla_backend.kdev4 -c++/carla-bridge/carla_bridge_plugin.cpp,bak -c++/carla-bridge/carla_bridge_toolkit-plugin.cpp -c++/carla/CarlaAbout.cpp -c++/carla/CarlaAbout.hpp -c++/carla/PluginParameter.cpp -c++/carla/PluginParameter.hpp -c++/carla/carla.cpp -c++/carla/carla.h -c++/carla/carla.pro -c++/carla/carla_misc.h -data/cadence-cpufreq -data/cpufreq/ -src/cadence_cpufreq.py -src/cpufreq.py +data/templates/energyXT.xt diff --git a/Makefile b/Makefile index 6ad31f8..a7413ba 100644 --- a/Makefile +++ b/Makefile @@ -19,10 +19,11 @@ else X11_RC_DIR = $(DESTDIR)/etc/X11/xinit/xinitrc.d/ endif +# ----------------------------------------------------------------------------------------------------------------------------------------- all: UI RES CPP -# ------------------------------------------------------------------------------------------------------------------------------------------------------ +# ----------------------------------------------------------------------------------------------------------------------------------------- UI: cadence catarina catia claudia tools @@ -48,129 +49,15 @@ tools: \ src/ui_%.py: resources/ui/%.ui $(PYUIC) $< -o $@ -# -# src/ui_cadence_tb_jack.py: resources/ui/cadence_tb_jack.ui -# $(PYUIC) $< -o $@ -# -# src/ui_cadence_tb_alsa.py: resources/ui/cadence_tb_alsa.ui -# $(PYUIC) $< -o $@ -# -# src/ui_cadence_tb_a2j.py: resources/ui/cadence_tb_a2j.ui -# $(PYUIC) $< -o $@ -# -# src/ui_cadence_tb_pa.py: resources/ui/cadence_tb_pa.ui -# $(PYUIC) $< -o $@ -# -# src/ui_cadence_rwait.py: resources/ui/cadence_rwait.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catarina.py: resources/ui/catarina.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catarina_addgroup.py: resources/ui/catarina_addgroup.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catarina_removegroup.py: resources/ui/catarina_removegroup.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catarina_renamegroup.py: resources/ui/catarina_renamegroup.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catarina_addport.py: resources/ui/catarina_addport.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catarina_removeport.py: resources/ui/catarina_removeport.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catarina_renameport.py: resources/ui/catarina_renameport.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catarina_connectports.py: resources/ui/catarina_connectports.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catarina_disconnectports.py: resources/ui/catarina_disconnectports.ui -# $(PYUIC) $< -o $@ -# -# src/ui_catia.py: resources/ui/catia.ui -# $(PYUIC) $< -o $@ -# -# src/ui_claudia.py: resources/ui/claudia.ui -# $(PYUIC) $< -o $@ -# -# src/ui_claudia_studioname.py: resources/ui/claudia_studioname.ui -# $(PYUIC) $< -o $@ -# -# src/ui_claudia_studiolist.py: resources/ui/claudia_studiolist.ui -# $(PYUIC) $< -o $@ -# -# src/ui_claudia_createroom.py: resources/ui/claudia_createroom.ui -# $(PYUIC) $< -o $@ -# -# src/ui_claudia_projectname.py: resources/ui/claudia_projectname.ui -# $(PYUIC) $< -o $@ -# -# src/ui_claudia_projectproperties.py: resources/ui/claudia_projectproperties.ui -# $(PYUIC) $< -o $@ -# -# src/ui_claudia_runcustom.py: resources/ui/claudia_runcustom.ui -# $(PYUIC) $< -o $@ -# -# src/ui_claudia_launcher.py: resources/ui/claudia_launcher.ui -# $(PYUIC) $< -o $@ -# -# src/ui_claudia_launcher_app.py: resources/ui/claudia_launcher_app.ui -# $(PYUIC) $< -o $@ -# -# src/ui_caitlyn.py: resources/ui/caitlyn.ui -# $(PYUIC) $< -o $@ -# -# src/ui_carla.py: resources/ui/carla.ui -# $(PYUIC) $< -o $@ -# -# src/ui_carla_control.py: resources/ui/carla_control.ui -# $(PYUIC) $< -o $@ -# -# src/ui_carla_about.py: resources/ui/carla_about.ui -# $(PYUIC) $< -o $@ -# -# src/ui_carla_database.py: resources/ui/carla_database.ui -# $(PYUIC) $< -o $@ -# -# src/ui_carla_edit.py: resources/ui/carla_edit.ui -# $(PYUIC) $< -o $@ -# -# src/ui_carla_parameter.py: resources/ui/carla_parameter.ui -# $(PYUIC) $< -o $@ -# -# src/ui_carla_plugin.py: resources/ui/carla_plugin.ui -# $(PYUIC) $< -o $@ -# -# src/ui_carla_refresh.py: resources/ui/carla_refresh.ui -# $(PYUIC) $< -o $@ -# -# src/ui_logs.py: resources/ui/logs.ui -# $(PYUIC) $< -o $@ -# -# src/ui_render.py: resources/ui/render.ui -# $(PYUIC) $< -o $@ -# -# src/ui_settings_app.py: resources/ui/settings_app.ui -# $(PYUIC) $< -o $@ -# -# src/ui_settings_jack.py: resources/ui/settings_jack.ui -# $(PYUIC) $< -o $@ -# -# src/ui_inputdialog_value.py: resources/ui/inputdialog_value.ui -# $(PYUIC) $< -o $@ -# ------------------------------------------------------------------------------------------------------------------------------------------------------ +# ----------------------------------------------------------------------------------------------------------------------------------------- RES: src/resources_rc.py src/resources_rc.py: resources/resources.qrc $(PYRCC) $< -o $@ -# ------------------------------------------------------------------------------------------------------------------------------------------------------ +# ----------------------------------------------------------------------------------------------------------------------------------------- CPP: jackmeter xycontroller @@ -180,18 +67,20 @@ jackmeter: xycontroller: $(MAKE) -C c++/xycontroller -# ------------------------------------------------------------------------------------------------------------------------------------------------------ +# ----------------------------------------------------------------------------------------------------------------------------------------- debug: $(MAKE) DEBUG=true -# ------------------------------------------------------------------------------------------------------------------------------------------------------ +# ----------------------------------------------------------------------------------------------------------------------------------------- clean: $(MAKE) clean -C c++/jackmeter $(MAKE) clean -C c++/xycontroller rm -f *~ src/*~ src/*.pyc src/ui_*.py src/resources_rc.py +# ----------------------------------------------------------------------------------------------------------------------------------------- + install: # Create directories install -d $(DESTDIR)$(PREFIX)/bin/ @@ -288,7 +177,6 @@ install: $(DESTDIR)$(PREFIX)/bin/catia \ $(DESTDIR)$(PREFIX)/bin/claudia \ $(DESTDIR)$(PREFIX)/bin/claudia-launcher \ - $(DESTDIR)$(PREFIX)/bin/caitlyn \ $(X11_RC_DIR)/70cadence-plugin-paths \ $(X11_RC_DIR)/99cadence-session-start diff --git a/doc/TODO b/TODO similarity index 95% rename from doc/TODO rename to TODO index 8a4dfd3..60ad05f 100644 --- a/doc/TODO +++ b/TODO @@ -29,9 +29,6 @@ Claudia-Launcher: - Finish plugins - Auto-close option -Carla: - - auto-tab height fix - ------------------- - MODULES - diff --git a/src/cadence.kdev4 b/src/cadence.kdev4 index 6ab756e..460f988 100644 --- a/src/cadence.kdev4 +++ b/src/cadence.kdev4 @@ -3,7 +3,7 @@ Manager=KDevGenericManager Name=Cadence [Filters] -Excludes=*/.*,*/*~,*/*.pyc,*/ui_*.py,*/__pycache__/,*/old/ +Excludes=*/.*,*/*~,*/*.pyc,*/ui_*.py,*/__pycache__/ [Project] VersionControlSupport=kdevgit diff --git a/src/canvaspreviewframe.py b/src/canvaspreviewframe.py new file mode 100644 index 0000000..6cf7fbf --- /dev/null +++ b/src/canvaspreviewframe.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Custom Mini Canvas Preview, a custom Qt4 widget +# Copyright (C) 2011-2012 Filipe Coelho +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# For a full copy of the GNU General Public License see the COPYING file + +# Imports (Global) +from PyQt4.QtCore import Qt, QRectF, QTimer, SIGNAL, SLOT +from PyQt4.QtGui import QBrush, QColor, QCursor, QFrame, QPainter, QPen + +iX = 0 +iY = 1 +iWidth = 2 +iHeight = 3 + +# Widget Class +class CanvasPreviewFrame(QFrame): + def __init__(self, parent): + QFrame.__init__(self, parent) + + self.m_mouseDown = False + + self.m_viewbrush = QBrush(QColor(75, 75, 255, 30)) + self.m_viewpen = QPen(Qt.blue, 1) + + self.scale = 1.0 + self.scene = None + self.real_parent = None + self.fake_width = 0 + self.fake_height = 0 + + self.render_source = self.getRenderSource() + self.render_target = QRectF(0, 0, 0, 0) + + self.view_pad_x = 0.0 + self.view_pad_y = 0.0 + self.view_rect = [0.0, 0.0, 10.0, 10.0] + + def init(self, scene, real_width, real_height): + self.scene = scene + self.fake_width = float(real_width) / 15 + self.fake_height = float(real_height) / 15 + + self.setMinimumSize(self.fake_width, self.fake_height) + self.setMaximumSize(self.fake_width * 4, self.fake_height) + + self.render_target.setWidth(real_width) + self.render_target.setHeight(real_height) + + def setRealParent(self, parent): + self.real_parent = parent + + def getRenderSource(self): + x_pad = (self.width() - self.fake_width) / 2 + y_pad = (self.height() - self.fake_height) / 2 + return QRectF(x_pad, y_pad, self.fake_width, self.fake_height) + + def setViewPosX(self, xp): + x = xp * self.fake_width + x_ratio = (x / self.fake_width) * self.view_rect[iWidth] / self.scale + self.view_rect[iX] = x - x_ratio + self.render_source.x() + self.update() + + def setViewPosY(self, yp): + y = yp * self.fake_height + y_ratio = (y / self.fake_height) * self.view_rect[iHeight] / self.scale + self.view_rect[iY] = y - y_ratio + self.render_source.y() + self.update() + + def setViewScale(self, scale): + self.scale = scale + QTimer.singleShot(0, self.real_parent, SLOT("slot_miniCanvasCheckAll()")) + + def setViewSize(self, width_p, height_p): + width = width_p * self.fake_width + height = height_p * self.fake_height + self.view_rect[iWidth] = width + self.view_rect[iHeight] = height + self.update() + + def setViewTheme(self, brushColor, penColor): + brushColor.setAlpha(40) + penColor.setAlpha(100) + self.m_viewbrush = QBrush(brushColor) + self.m_viewpen = QPen(penColor, 1) + + def handleMouseEvent(self, event_x, event_y): + x = float(event_x) - self.render_source.x() - (self.view_rect[iWidth] / self.scale / 2) + y = float(event_y) - self.render_source.y() - (self.view_rect[iHeight] / self.scale / 2) + + max_width = self.view_rect[iWidth] / self.scale + max_height = self.view_rect[iHeight] / self.scale + + if max_width > self.fake_width: + max_width = self.fake_width + if max_height > self.fake_height: + max_height = self.fake_height + + if x < 0.0: + x = 0.0 + elif x > self.fake_width - max_width: + x = self.fake_width - max_width + + if y < 0.0: + y = 0.0 + elif y > self.fake_height - max_height: + y = self.fake_height - max_height + + self.view_rect[iX] = x + self.render_source.x() + self.view_rect[iY] = y + self.render_source.y() + self.update() + + self.emit(SIGNAL("miniCanvasMoved(double, double)"), x * self.scale / self.fake_width, y * self.scale / self.fake_height) + + def mousePressEvent(self, event): + if event.button() == Qt.LeftButton: + self.m_mouseDown = True + self.setCursor(QCursor(Qt.SizeAllCursor)) + self.handleMouseEvent(event.x(), event.y()) + event.accept() + + def mouseMoveEvent(self, event): + if self.m_mouseDown: + self.handleMouseEvent(event.x(), event.y()) + event.accept() + + def mouseReleaseEvent(self, event): + if self.m_mouseDown: + self.setCursor(QCursor(Qt.ArrowCursor)) + self.m_mouseDown = False + QFrame.mouseReleaseEvent(self, event) + + def paintEvent(self, event): + painter = QPainter(self) + + painter.setBrush(QBrush(Qt.darkBlue, Qt.DiagCrossPattern)) + painter.drawRect(0, 0, self.width(), self.height()) + + self.scene.render(painter, self.render_source, self.render_target, Qt.KeepAspectRatio) + + max_width = self.view_rect[iWidth] / self.scale + max_height = self.view_rect[iHeight] / self.scale + + if max_width > self.fake_width: + max_width = self.fake_width + if max_height > self.fake_height: + max_height = self.fake_height + + painter.setBrush(self.m_viewbrush) + painter.setPen(self.m_viewpen) + painter.drawRect(self.view_rect[iX], self.view_rect[iY], max_width, max_height) + + QFrame.paintEvent(self, event) + + def resizeEvent(self, event): + self.render_source = self.getRenderSource() + if self.real_parent: + QTimer.singleShot(0, self.real_parent, SLOT("slot_miniCanvasCheckAll()")) + QFrame.resizeEvent(self, event) diff --git a/src/clickablelabel.py b/src/clickablelabel.py new file mode 100644 index 0000000..baa87be --- /dev/null +++ b/src/clickablelabel.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Clickable Label, a custom Qt4 widget +# Copyright (C) 2011-2012 Filipe Coelho +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# For a full copy of the GNU General Public License see the COPYING file + +# Imports (Global) +from PyQt4.QtCore import pyqtSlot, Qt, QTimer, SIGNAL, SLOT +from PyQt4.QtGui import QLabel + +# Widget Class +class ClickableLabel(QLabel): + def __init__(self, parent): + QLabel.__init__(self, parent) + + self.setCursor(Qt.PointingHandCursor) + + def mousePressEvent(self, event): + self.emit(SIGNAL("clicked()")) + # Use busy cursor for 2 secs + self.setCursor(Qt.WaitCursor) + QTimer.singleShot(2000, self, SLOT("slot_setNormalCursor()")) + QLabel.mousePressEvent(self, event) + + @pyqtSlot() + def slot_setNormalCursor(self): + self.setCursor(Qt.PointingHandCursor)