Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
darkoverlordofdata committed Nov 30, 2022
0 parents commit c66adbb
Show file tree
Hide file tree
Showing 22 changed files with 607 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
obj
*.app
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${workspaceFolder}/${workspaceFolderBasename}.app/${workspaceFolderBasename}",
"args": [],
"cwd": "${workspaceFolder}/${workspaceFolderBasename}.app"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": false
}
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "gmake",
"args": []
}
]
}
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.1)

# Project
Project(DailyBing VERSION 1.0.0)
find_library(COCOA_LIBRARY Cocoa)

# Options
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
set(MACOSX_BUNDLE_COPYRIGHT "© 2022 by darkoverlordofdata")
set(MACOSX_BUNDLE_INFO_STRING "Select a Bing Picture of the Day")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.darkoverlordofdata.dailybing")

# Resources
set_source_files_properties(Resources/DailyBing.png PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")

# Application
add_executable(${PROJECT_NAME} MACOSX_BUNDLE main.m Controller.m Window.m Resources/Logo.png)
target_link_libraries(${PROJECT_NAME} ${COCOA_LIBRARY})
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER ".")
16 changes: 16 additions & 0 deletions Controller.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

#import "Window.h"

@interface Controller : NSObject
{
Window *window;
}

// - (void)applicationWillFinishLaunching:(NSNotification *) not;
- (void)applicationDidFinishLaunching:(NSNotification *) not;


@end

16 changes: 16 additions & 0 deletions Controller.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#import <time.h>

#import "Controller.h"

@implementation Controller

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
{
window = [[Window alloc] init];
[window setDelegate:self];
}

@end


17 changes: 17 additions & 0 deletions DailyBingInfo.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
ApplicationDescription = "Bing Picture Of the Day";
ApplicationIcon = "DailyBing.png";
ApplicationName = DailyBing;
ApplicationRelease = "1.0.0";
Authors = (
"darkoverlordofdata"
);
Copyright = "Copyright (C) 2022 BSD 2 clause.";
CopyrightDescription = "Released under BSD 2 clause";
FullVersionID = "1.0.0";
NSExecutable = DailyBing;
NSIcon = "DailyBing.png";
NSPrincipalClass = NSApplication;
NSRole = Application;
URL = "http://darkoverlordofdata.com/application/";
}
50 changes: 50 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
# GNUmakefile - Generated by ProjectCenter
#
ifeq ($(GNUSTEP_MAKEFILES),)
GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
endif
ifeq ($(GNUSTEP_MAKEFILES),)
$(error You need to set GNUSTEP_MAKEFILES before compiling!)
endif

include $(GNUSTEP_MAKEFILES)/common.make

#
# DailyBing
#
VERSION = 1.0.0
PACKAGE_NAME = DailyBing
APP_NAME = DailyBing
DailyBing_APPLICATION_ICON = DailyBing.png


#
# Resource files
#
DailyBing_RESOURCE_FILES = \
Resources/DailyBing.png

#
# Header files
#
DailyBing_HEADER_FILES = \
Window.h \
Controller.h

#
# Class files
#
DailyBing_OBJC_FILES = \
main.m \
Window.m \
Controller.m


#
# Makefiles
#
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
include $(GNUSTEP_MAKEFILES)/application.make
-include GNUmakefile.postamble
1 change: 1 addition & 0 deletions HPImageArchive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"images":[{"startdate":"20221129","fullstartdate":"202211290800","enddate":"20221130","url":"/th?id=OHR.HeronGiving_EN-US9774285216_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp","urlbase":"/th?id=OHR.HeronGiving_EN-US9774285216","copyright":"Great blue herons building a nest in Wakodahatchee Wetlands, Delray Beach, Florida (© Imagebroker/Alamy)","copyrightlink":"https://www.bing.com/search?q=giving+tuesday&form=hpcapt&filters=HpDate%3a%2220221129_0800%22","title":"A day for giving","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20221129_HeronGiving%22&FORM=HPQUIZ","wp":true,"hsh":"d113d81f469c96bda2d895cfd32e31d2","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20221128","fullstartdate":"202211280800","enddate":"20221129","url":"/th?id=OHR.RedPlanetDay_EN-US9693219784_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp","urlbase":"/th?id=OHR.RedPlanetDay_EN-US9693219784","copyright":"Mars (© NASA/Alamy)","copyrightlink":"https://www.bing.com/search?q=Mars+planet&form=hpcapt&filters=HpDate%3a%2220221128_0800%22","title":"Fourth rock from the sun","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20221128_RedPlanetDay%22&FORM=HPQUIZ","wp":true,"hsh":"3d31fa46fee528d7998eb847f376c702","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20221127","fullstartdate":"202211270800","enddate":"20221128","url":"/th?id=OHR.Cecropia_EN-US9602789937_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp","urlbase":"/th?id=OHR.Cecropia_EN-US9602789937","copyright":"Cecropia leaf atop lobster claw petals, Mexico (© Gerry Ellis/Minden Pictures)","copyrightlink":"https://www.bing.com/search?q=Cecropia&form=hpcapt&filters=HpDate%3a%2220221127_0800%22","title":"Unbe-leaf-able","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20221127_Cecropia%22&FORM=HPQUIZ","wp":true,"hsh":"bb8c8d1568eda76a3575949b56a23f5d","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20221126","fullstartdate":"202211260800","enddate":"20221127","url":"/th?id=OHR.OliveTreeDay_EN-US9460125670_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp","urlbase":"/th?id=OHR.OliveTreeDay_EN-US9460125670","copyright":"An olive tree in front of the Temple of Concordia on the island of Sicily, Italy (© Alfio Finocchiaro/Shutterstock)","copyrightlink":"https://www.bing.com/search?q=world+olive+tree+day+unesco&form=hpcapt&filters=HpDate%3a%2220221126_0800%22","title":"A symbol of peace","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20221126_OliveTreeDay%22&FORM=HPQUIZ","wp":true,"hsh":"ee7b58af12cee118f8d88170c81879d7","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20221125","fullstartdate":"202211250800","enddate":"20221126","url":"/th?id=OHR.MonksMound_EN-US9323884241_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp","urlbase":"/th?id=OHR.MonksMound_EN-US9323884241","copyright":"Monks Mound at the Cahokia Mounds UNESCO World Heritage Site near Collinsville, Illinois (© Matthew Gush/Alamy)","copyrightlink":"https://www.bing.com/search?q=native+american+heritage+day&form=hpcapt&filters=HpDate%3a%2220221125_0800%22","title":"Pyramid built by Native Americans","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20221125_MonksMound%22&FORM=HPQUIZ","wp":true,"hsh":"3c986250c94574c1deac9fad2f7d52e6","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20221124","fullstartdate":"202211240800","enddate":"20221125","url":"/th?id=OHR.CranberryBog_EN-US4145520322_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp","urlbase":"/th?id=OHR.CranberryBog_EN-US4145520322","copyright":"Cranberry bog (© SHSPhotography/Getty Images)","copyrightlink":"https://www.bing.com/search?q=thanksgiving+day+history&form=hpcapt&filters=HpDate%3a%2220221124_0800%22","title":"A crimson quagmire","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20221124_CranberryBog%22&FORM=HPQUIZ","wp":true,"hsh":"1c73eaacd2ea4e2a1030e1b714455798","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20221123","fullstartdate":"202211230800","enddate":"20221124","url":"/th?id=OHR.HelianthusAnnuus_EN-US9168789034_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp","urlbase":"/th?id=OHR.HelianthusAnnuus_EN-US9168789034","copyright":"Sunflower (© Dileep Chandran/Alamy)","copyrightlink":"https://www.bing.com/search?q=fibonacci+day&form=hpcapt&filters=HpDate%3a%2220221123_0800%22","title":"Nature, art, and...math?","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20221123_HelianthusAnnuus%22&FORM=HPQUIZ","wp":true,"hsh":"8e2e2981ecf8f35ea431591a4a9913f4","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20221122","fullstartdate":"202211220800","enddate":"20221123","url":"/th?id=OHR.Waterleidingduinen_EN-US9090200846_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp","urlbase":"/th?id=OHR.Waterleidingduinen_EN-US9090200846","copyright":"Red fox in Amsterdamse Waterleidingduinen Nature Reserve, Netherlands (© Edwin Giesbers/Minden Pictures)","copyrightlink":"https://www.bing.com/search?q=Red+fox&form=hpcapt&filters=HpDate%3a%2220221122_0800%22","title":"A fox in the dunes","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20221122_Waterleidingduinen%22&FORM=HPQUIZ","wp":true,"hsh":"f553b0968ce9f8017291fde2acdae1bd","drk":1,"top":1,"bot":1,"hs":[]}],"tooltips":{"loading":"Loading...","previous":"Previous image","next":"Next image","walle":"This image is not available to download as wallpaper.","walls":"Download this image. Use of this image is restricted to wallpaper only."}}
47 changes: 47 additions & 0 deletions NSPatch/NSGuiDefines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#import <Cocoa/Cocoa.h>

// missing enum values in gnustep-gui

#define NSBezelStyleRounded 1
#define NSBezelStyleRegularSquare 2
#define NSBezelStyleShadowlessSquare 6
#define NSBezelStyleSmallSquare 10
#define NSBezelStyleRoundRect 12
#define NSBezelStyleInline 15
#define NSBezelStyleRecessed 13
#define NSBezelStyleDisclosure 5
#define NSBezelStyleRoundedDisclosure 14
#define NSBezelStyleCircular 7
#define NSBezelStyleHelpButton 9
#define NSBezelStyleTexturedRounded 12
#define NSBezelStyleTexturedSquare 8

#define NSButtonTypeSwitch NSSwitchButton
#define NSButtonTypeOnOff NSOnOffButton

#define NSButtonTypeRadio NSRadioButton

#define NSEventMaskAny NSUIntegerMax

#define NSEventModifierFlagCapsLock (1 << 16)
#define NSEventModifierFlagShift (1 << 17)
#define NSEventModifierFlagControl (1 << 18)
#define NSEventModifierFlagOption (1 << 19)
#define NSEventModifierFlagCommand (1 << 20)
#define NSEventModifierFlagNumericPad (1 << 21)
#define NSEventModifierFlagHelp (1 << 22)
#define NSEventModifierFlagFunction (1 << 23)
#define NSEventModifierFlagDeviceIndependentFlagsMask = 0xffff0000UL


#define NSEventMaskAny NSUIntegerMax

#define NSAlertStyleCritical 2
#define NSAlertStyleInformational 1
#define NSAlertStyleWarning 0

#define NSTabPositionNone 0
#define NSTabPositionTop 1
#define NSTabPositionLeft 2
#define NSTabPositionBottom 3
#define NSTabPositionRight 4
7 changes: 7 additions & 0 deletions NSPatch/NSPatch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// compatibility patches


// sudo cp -rf NSPatch /usr/local/include

#import "NSGuiDefines.h"
// #import "NSWindow+SetIsVisible.h"
31 changes: 31 additions & 0 deletions NSPatch/NSWindow+SetIsVisible.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#import <Cocoa/Cocoa.h>

/*
not required in GNUstep 1.9
required in GNUstep 2.0
not required in GNUstep 2.1
*/
@interface NSWindow (NSWindowSetIsVisible)
- (void)setIsVisible: (BOOL) yes_no;
@end

@implementation NSWindow (NSWindowSetIsVisible)
- (void)setIsVisible: (BOOL) flag {
// _f.visible = flag;
if (flag)
{
[self orderFrontRegardless];
}
else
{
[self orderOut: nil];
}
// if (yes_no) {
// [self center];
// [self orderFrontRegardless];
// [self makeKeyWindow];
// [self display];
// }
}
@end
5 changes: 5 additions & 0 deletions NSPatch/nspatch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* NSPatch

various cocoa patches for objc 2.0 on Linux

sudo cp -rf NSPatch /usr/local/include
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# dailybing

prototype for selecting the daily bing

## ill behaviour:
this demonstrates NSImageView loading the wrong image i.e. whatever image is loaded first is the only image displayed.

## build

GNUastep:
```
cd DailyBing
gmake
```
Binary file added Resources/DailyBing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions Window.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#import <Cocoa/Cocoa.h>


@interface Window : NSWindow {
NSImageView* pictureBox1;
NSImageView* pictureBox2;
}
- (instancetype)init;
- (BOOL)windowShouldClose:(id)sender;

@end
35 changes: 35 additions & 0 deletions Window.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#import <Cocoa/Cocoa.h>
#import "Window.h"

@implementation Window
- (instancetype)init {

pictureBox1 = [[[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 240, 135)] autorelease];
pictureBox2 = [[[NSImageView alloc] initWithFrame:NSMakeRect(240, 0, 240, 135)] autorelease];

[super initWithContentRect:NSMakeRect(0, 0, 1920, 140) styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO];
[self setTitle:@"Bing Picture Of the Day"];
[[self contentView] addSubview:pictureBox1];
[[self contentView] addSubview:pictureBox2];
[self setIsVisible:YES];

NSURL *url1 = [NSURL URLWithString:@"https://www.bing.com/th?id=OHR.RedPlanetDay_EN-US9693219784_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp"];
NSURL *url2 = [NSURL URLWithString:@"https://www.bing.com/th?id=OHR.HeronGiving_EN-US9774285216_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp"];

NSImage *img1 = [[NSImage alloc] initWithContentsOfURL:url1];
NSImage *img2 = [[NSImage alloc] initWithContentsOfURL:url2];

[pictureBox1 setImage:img1];
[pictureBox2 setImage:img2];

return self;
}

- (BOOL)windowShouldClose:(id)sender {
[NSApp terminate:sender];
return YES;
}


@end

Loading

0 comments on commit c66adbb

Please sign in to comment.